Set server state to Failed if a response to a heartbeat Ping never comes

This commit is contained in:
Deirdre Connolly 2019-10-18 21:30:19 -04:00 committed by Deirdre Connolly
parent adffc4239d
commit 3548998980
1 changed files with 4 additions and 1 deletions

View File

@ -121,8 +121,11 @@ where
Either::Right(((), _peer_fut)) => {
trace!("client request timed out");
// Re-matching lets us take ownership of tx
// XXX check here for Ping heartbeat timeout?
self.state = match self.state {
ServerState::AwaitingResponse(Request::Ping(_), _) => {
self.fail_with(PeerError::ClientRequestTimeout);
ServerState::Failed
}
ServerState::AwaitingResponse(_, tx) => {
let e = PeerError::ClientRequestTimeout;
let _ = tx.send(Err(Arc::new(e).into()));