diff --git a/src/socket/tcp.rs b/src/socket/tcp.rs index 5ebd25a..53edeef 100644 --- a/src/socket/tcp.rs +++ b/src/socket/tcp.rs @@ -38,7 +38,7 @@ impl<'a> SocketBuffer<'a> { } fn empty(&self) -> bool { - self.length != 0 + self.len() == 0 } fn full(&self) -> bool { @@ -331,6 +331,14 @@ impl<'a> TcpSocket<'a> { } } + /// Return whether the socket is passively listening for incoming connections. + pub fn is_listening(&self) -> bool { + match self.state { + State::Listen => true, + _ => false + } + } + /// Return whether the socket is open. /// /// This function returns true if the socket will process incoming or dispatch outgoing @@ -344,14 +352,6 @@ impl<'a> TcpSocket<'a> { } } - /// Return whether the socket is passively listening for incoming connections. - pub fn is_listening(&self) -> bool { - match self.state { - State::Listen => true, - _ => false - } - } - /// Return whether a connection is active. /// /// This function returns true if the socket is actively exchanging packets with