From 91276ad82e702dca8f3183511fcfed7703c70a5c Mon Sep 17 00:00:00 2001 From: arkpar Date: Sun, 21 Feb 2016 16:52:25 +0100 Subject: [PATCH] Added comments --- util/src/network/connection.rs | 1 + util/src/network/handshake.rs | 1 + util/src/network/session.rs | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/util/src/network/connection.rs b/util/src/network/connection.rs index 0135fc333..a7396ff33 100644 --- a/util/src/network/connection.rs +++ b/util/src/network/connection.rs @@ -175,6 +175,7 @@ impl Connection { self.socket.peer_addr() } + /// Clone this connection. Clears the receiving buffer of the returned connection. pub fn try_clone(&self) -> io::Result { Ok(Connection { token: self.token, diff --git a/util/src/network/handshake.rs b/util/src/network/handshake.rs index a50dd6ba2..087de63b3 100644 --- a/util/src/network/handshake.rs +++ b/util/src/network/handshake.rs @@ -176,6 +176,7 @@ impl Handshake { Ok(()) } + /// Update socket registration with the event loop. pub fn update_socket>(&self, reg: Token, event_loop: &mut EventLoop) -> Result<(), UtilError> { if !self.expired() { try!(self.connection.update_socket(reg, event_loop)); diff --git a/util/src/network/session.rs b/util/src/network/session.rs index 6be1dbfe4..edf929a9a 100644 --- a/util/src/network/session.rs +++ b/util/src/network/session.rs @@ -111,7 +111,8 @@ const PACKET_USER: u8 = 0x10; const PACKET_LAST: u8 = 0x7f; impl Session { - /// Create a new session out of comepleted handshake. + /// Create a new session out of comepleted handshake. This clones the handshake connection object + /// and leaves the handhsake in limbo to be deregistered from the event loop. pub fn new(h: &mut Handshake, host: &HostInfo) -> Result { let id = h.id.clone(); let connection = try!(EncryptedConnection::new(h)); @@ -189,7 +190,7 @@ impl Session { } /// Register the session socket with the event loop - pub fn register_socket>(&self, reg: Token, event_loop: &mut EventLoop) -> Result<(), UtilError> { + pub fn register_socket>(&self, reg: Token, event_loop: &mut EventLoop) -> Result<(), UtilError> { if self.expired() { return Ok(()); }