Handle incoming Reject messages when we expect a response

This commit is contained in:
Deirdre Connolly 2019-11-26 02:02:46 -05:00 committed by Deirdre Connolly
parent efd37300b9
commit f5f1fe9bbc
1 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,4 @@
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);