mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-12-22 19:49:28 +00:00
monero-p2p: tell client message was sent after sending message.
Otherwise, the message might not be sent
This commit is contained in:
parent
f7149863ae
commit
0cc2acc816
2 changed files with 10 additions and 4 deletions
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
//! A tokio-codec for levin buckets
|
//! A tokio-codec for levin buckets
|
||||||
|
|
||||||
use std::io::ErrorKind;
|
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use bytes::{Buf, BufMut, BytesMut};
|
use bytes::{Buf, BufMut, BytesMut};
|
||||||
|
|
|
@ -97,11 +97,18 @@ where
|
||||||
request_id: req.request.id(),
|
request_id: req.request.id(),
|
||||||
tx: req.response_channel,
|
tx: req.response_channel,
|
||||||
};
|
};
|
||||||
|
self.send_message_to_peer(req.request.into()).await?;
|
||||||
} else {
|
} else {
|
||||||
// TODO: we should send this after sending the message to the peer.
|
let res = self.send_message_to_peer(req.request.into()).await;
|
||||||
req.response_channel.send(Ok(PeerResponse::NA));
|
if let Err(e) = res {
|
||||||
|
let err_str = e.to_string();
|
||||||
|
let _ = req.response_channel.send(Err(err_str.clone().into()));
|
||||||
|
Err(e)?
|
||||||
|
} else {
|
||||||
|
req.response_channel.send(Ok(PeerResponse::NA));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.send_message_to_peer(req.request.into()).await
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_peer_request(&mut self, req: PeerRequest) -> Result<(), PeerError> {
|
async fn handle_peer_request(&mut self, req: PeerRequest) -> Result<(), PeerError> {
|
||||||
|
|
Loading…
Reference in a new issue