diff --git a/p2p/p2p-core/src/client.rs b/p2p/p2p-core/src/client.rs index 7deb88a..8685189 100644 --- a/p2p/p2p-core/src/client.rs +++ b/p2p/p2p-core/src/client.rs @@ -169,9 +169,8 @@ impl Service for Client { TrySendError::Closed(req) | TrySendError::Full(req) => { self.set_err(PeerError::ClientChannelClosed); - let _unused = req - .response_channel - .send(Err(PeerError::ClientChannelClosed.into())); + let resp = Err(PeerError::ClientChannelClosed.into()); + drop(req.response_channel.send(resp)); } } } @@ -216,7 +215,7 @@ where tracing::debug!("Sending back response"); - let _unused = req.response_channel.send(Ok(res)); + drop(req.response_channel.send(Ok(res))); } } .instrument(task_span), diff --git a/p2p/p2p-core/src/client/connection.rs b/p2p/p2p-core/src/client/connection.rs index 1353c8e..f7b9be5 100644 --- a/p2p/p2p-core/src/client/connection.rs +++ b/p2p/p2p-core/src/client/connection.rs @@ -174,14 +174,13 @@ where if let Err(e) = res { // can't clone the error so turn it to a string first, hacky but oh well. let err_str = e.to_string(); - let _unused = req.response_channel.send(Err(err_str.into())); + drop(req.response_channel.send(Err(err_str.into()))); return Err(e); } // We still need to respond even if the response is this. - let _unused = req - .response_channel - .send(Ok(PeerResponse::Protocol(ProtocolResponse::NA))); + let resp = Ok(PeerResponse::Protocol(ProtocolResponse::NA)); + drop(req.response_channel.send(resp)); Ok(()) } @@ -224,9 +223,11 @@ where panic!("Not in correct state, can't receive response!") }; - let _unused = tx.send(Ok(mes + let resp = Ok(mes .try_into() - .map_err(|_| PeerError::PeerSentInvalidMessage)?)); + .map_err(|_| PeerError::PeerSentInvalidMessage)?); + + drop(tx.send(resp)); self.request_timeout = None; @@ -366,11 +367,11 @@ where if let State::WaitingForResponse { tx, .. } = std::mem::replace(&mut self.state, State::WaitingForRequest) { - let _unused = tx.send(Err(err_str.clone().into())); + drop(tx.send(Err(err_str.clone().into()))); } while let Ok(req) = client_rx.try_recv() { - let _unused = req.response_channel.send(Err(err_str.clone().into())); + drop(req.response_channel.send(Err(err_str.clone().into()))); } self.connection_guard.connection_closed(); diff --git a/p2p/p2p-core/src/tests.rs b/p2p/p2p-core/src/tests.rs deleted file mode 100644 index 4d96c55..0000000 --- a/p2p/p2p-core/src/tests.rs +++ /dev/null @@ -1,4 +0,0 @@ -mod fragmented_handshake; -mod handles; -mod handshake; -mod sending_receiving; diff --git a/p2p/p2p-core/tests/fragmented_handshake.rs b/p2p/p2p-core/tests/fragmented_handshake.rs index 679f829..1235df9 100644 --- a/p2p/p2p-core/tests/fragmented_handshake.rs +++ b/p2p/p2p-core/tests/fragmented_handshake.rs @@ -187,7 +187,7 @@ async fn fragmented_handshake_monerod_to_cuprate() { let next_connection_fut = timeout(Duration::from_secs(30), listener.next()); if let Some(Ok((addr, stream, sink))) = next_connection_fut.await.unwrap() { - let _unused = handshaker + handshaker .ready() .await .unwrap() diff --git a/p2p/p2p-core/tests/handshake.rs b/p2p/p2p-core/tests/handshake.rs index 4170151..86d62ed 100644 --- a/p2p/p2p-core/tests/handshake.rs +++ b/p2p/p2p-core/tests/handshake.rs @@ -149,7 +149,7 @@ async fn handshake_monerod_to_cuprate() { let next_connection_fut = timeout(Duration::from_secs(30), listener.next()); if let Some(Ok((addr, stream, sink))) = next_connection_fut.await.unwrap() { - let _unused = handshaker + handshaker .ready() .await .unwrap()