From be18fb26556e125fb2587595d2d869b2c8807559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 30 May 2020 15:04:49 +0200 Subject: [PATCH] aquatic_ws network connection: improve documentation --- aquatic_ws/src/lib/network/connection.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aquatic_ws/src/lib/network/connection.rs b/aquatic_ws/src/lib/network/connection.rs index befcbf9..a79c8ef 100644 --- a/aquatic_ws/src/lib/network/connection.rs +++ b/aquatic_ws/src/lib/network/connection.rs @@ -199,6 +199,14 @@ pub struct Connection { /// Create from TcpStream. Run `advance_handshakes` until `get_established_ws` /// returns Some(EstablishedWs). +/// +/// advance_handshakes takes ownership of self because the TLS and WebSocket +/// handshake methods do. get_established_ws doesn't, since work can be done +/// on a mutable reference to a tungstenite websocket, and this way, the whole +/// Connection doesn't have to be removed from and reinserted into the +/// TorrentMap. This is also the reason for wrapping Container.inner in an +/// Either instead of combining all states into one structure just having a +/// single method for advancing handshakes and maybe returning a websocket. impl Connection { #[inline] pub fn new(