diff options
Diffstat (limited to 'src/conn.rs')
-rw-r--r-- | src/conn.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/conn.rs b/src/conn.rs index 6c5f38a..474032d 100644 --- a/src/conn.rs +++ b/src/conn.rs @@ -39,11 +39,11 @@ impl ServerConn { let handshake = handshake_server( &mut asyncstd_socket, netapp.netid.clone(), - netapp.id.clone(), + netapp.id, netapp.privkey.clone(), ) .await?; - let peer_id = handshake.peer_pk.clone(); + let peer_id = handshake.peer_pk; let tokio_socket = asyncstd_socket.into_inner(); let remote_addr = tokio_socket.peer_addr()?; @@ -69,12 +69,12 @@ impl ServerConn { let conn = Arc::new(ServerConn { netapp: netapp.clone(), remote_addr, - peer_id: peer_id.clone(), + peer_id, resp_send, close_send, }); - netapp.connected_as_server(peer_id.clone(), conn.clone()); + netapp.connected_as_server(peer_id, conn.clone()); let conn2 = conn.clone(); let conn3 = conn.clone(); @@ -123,7 +123,7 @@ impl RecvLoop for ServerConn { if let Some(handler) = self.netapp.msg_handlers.load().get(&kind) { let net_handler = &handler.net_handler; - let resp = net_handler(self.peer_id.clone(), bytes.slice(5..)).await; + let resp = net_handler(self.peer_id, bytes.slice(5..)).await; self.resp_send .send(Some((id, prio, resp))) .log_err("ServerConn recv_handler send resp"); @@ -153,9 +153,9 @@ impl ClientConn { let handshake = handshake_client( &mut asyncstd_socket, netapp.netid.clone(), - netapp.id.clone(), + netapp.id, netapp.privkey.clone(), - peer_id.clone(), + peer_id, ) .await?; @@ -182,7 +182,7 @@ impl ClientConn { let conn = Arc::new(ClientConn { remote_addr, - peer_id: peer_id.clone(), + peer_id, next_query_number: AtomicU16::from(0u16), query_send, inflight: Mutex::new(HashMap::new()), @@ -190,7 +190,7 @@ impl ClientConn { stop_recv_loop, }); - netapp.connected_as_client(peer_id.clone(), conn.clone()); + netapp.connected_as_client(peer_id, conn.clone()); tokio::spawn(async move { let conn2 = conn.clone(); |