Put the debug_id field first in sockets.

This has been annoying me far too long.
v0.7.x
whitequark 2017-07-27 22:55:30 +00:00
parent ad12573f62
commit 02f005a2bb
3 changed files with 6 additions and 6 deletions

View File

@ -47,11 +47,11 @@ pub type SocketBuffer<'a, 'b: 'a> = RingBuffer<'a, PacketBuffer<'b>>;
/// transmit and receive packet buffers.
#[derive(Debug)]
pub struct RawSocket<'a, 'b: 'a> {
debug_id: usize,
ip_version: IpVersion,
ip_protocol: IpProtocol,
rx_buffer: SocketBuffer<'a, 'b>,
tx_buffer: SocketBuffer<'a, 'b>,
debug_id: usize,
}
impl<'a, 'b> RawSocket<'a, 'b> {
@ -61,11 +61,11 @@ impl<'a, 'b> RawSocket<'a, 'b> {
rx_buffer: SocketBuffer<'a, 'b>,
tx_buffer: SocketBuffer<'a, 'b>) -> Socket<'a, 'b> {
Socket::Raw(RawSocket {
debug_id: 0,
ip_version,
ip_protocol,
rx_buffer,
tx_buffer,
debug_id: 0,
})
}

View File

@ -225,6 +225,7 @@ impl Retransmit {
/// attempts will be reset.
#[derive(Debug)]
pub struct TcpSocket<'a> {
debug_id: usize,
/// State of the socket.
state: State,
/// Address passed to listen(). Listen address is set when listen() is called and
@ -263,7 +264,6 @@ pub struct TcpSocket<'a> {
time_wait_since: u64,
rx_buffer: SocketBuffer<'a>,
tx_buffer: SocketBuffer<'a>,
debug_id: usize
}
const DEFAULT_MSS: usize = 536;
@ -280,6 +280,7 @@ impl<'a> TcpSocket<'a> {
}
Socket::Tcp(TcpSocket {
debug_id: 0,
state: State::Closed,
listen_address: IpAddress::default(),
local_endpoint: IpEndpoint::default(),
@ -294,7 +295,6 @@ impl<'a> TcpSocket<'a> {
time_wait_since: 0,
tx_buffer: tx_buffer.into(),
rx_buffer: rx_buffer.into(),
debug_id: 0
})
}

View File

@ -61,10 +61,10 @@ pub type SocketBuffer<'a, 'b : 'a> = RingBuffer<'a, PacketBuffer<'b>>;
/// packet buffers.
#[derive(Debug)]
pub struct UdpSocket<'a, 'b: 'a> {
debug_id: usize,
endpoint: IpEndpoint,
rx_buffer: SocketBuffer<'a, 'b>,
tx_buffer: SocketBuffer<'a, 'b>,
debug_id: usize
}
impl<'a, 'b> UdpSocket<'a, 'b> {
@ -72,10 +72,10 @@ impl<'a, 'b> UdpSocket<'a, 'b> {
pub fn new(rx_buffer: SocketBuffer<'a, 'b>,
tx_buffer: SocketBuffer<'a, 'b>) -> Socket<'a, 'b> {
Socket::Udp(UdpSocket {
debug_id: 0,
endpoint: IpEndpoint::default(),
rx_buffer: rx_buffer,
tx_buffer: tx_buffer,
debug_id: 0
})
}