Handle incoming Reject messages when we expect a response
+use std::error::Error;
use std::sync::Arc;
use futures::{
@@ -276,6 +277,24 @@ where
}
AwaitingRequest
}
+ (
+ AwaitingResponse(_, tx),
+ Message::Reject {
+ message,
+ ccode,
+ reason,
+ data,
+ },
+ ) => {
+ tx.send(Err(SharedPeerError::from(Arc::new(PeerError::Rejected))))
+ .expect("response oneshot should be unused");
+
+ error!(
+ "{:?} message rejected: {:?}, {:?}, {:?}",
+ message, ccode, reason, data
+ );
+ AwaitingRequest
+ }
// By default, messages are not responses.
(state, msg) => {
ignored_msg = Some(msg);
