Browse Source

Fix inverted meaning of TcpSocketBuffer::empty().

whitequark 8 years ago
parent
commit
a624559127
1 changed files with 9 additions and 9 deletions
  1. 9 9
      src/socket/tcp.rs

+ 9 - 9
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