From 51d8afe5790ea64142ae5a2847efe27211eb739d Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 15 Jan 2017 11:00:04 +0000 Subject: [PATCH] Fix inverted meaning of TcpSocketBuffer::empty(). --- src/socket/tcp.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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