mirror of
https://github.com/hinto-janai/cuprate.git
synced 2025-01-10 12:54:44 +00:00
fixes
This commit is contained in:
parent
719f4cd64d
commit
077db2f951
5 changed files with 14 additions and 18 deletions
|
@ -169,9 +169,8 @@ impl<Z: NetworkZone> Service<PeerRequest> for Client<Z> {
|
|||
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),
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
mod fragmented_handshake;
|
||||
mod handles;
|
||||
mod handshake;
|
||||
mod sending_receiving;
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue