Make sure FailedInit never escapes Inbound::poll_ready

This commit is contained in:
teor 2021-01-29 13:06:24 +10:00
parent 983e94f9e4
commit 09c8c89462
1 changed files with 7 additions and 2 deletions

View File

@ -183,8 +183,8 @@ impl Service<zn::Request> for Inbound {
Setup::FailedRecv { error } Setup::FailedRecv { error }
} }
}, },
// Make sure we left the network setup in a valid state // Make sure previous network setups were left in a valid state
Setup::FailedInit => unreachable!("incomplete Inbound initialization"), Setup::FailedInit => unreachable!("incomplete previous Inbound initialization"),
// If network setup failed, report service failure // If network setup failed, report service failure
Setup::FailedRecv { error } => { Setup::FailedRecv { error } => {
result = Err(error.clone().into()); result = Err(error.clone().into());
@ -203,6 +203,11 @@ impl Service<zn::Request> for Inbound {
} }
}; };
// Make sure we're leaving the network setup in a valid state
if matches!(self.network_setup, Setup::FailedInit) {
unreachable!("incomplete Inbound initialization after poll_ready state handling");
}
// TODO: // TODO:
// * do we want to propagate backpressure from the download queue or its outbound network? // * do we want to propagate backpressure from the download queue or its outbound network?
// currently, the download queue waits for the outbound network in the download future, // currently, the download queue waits for the outbound network in the download future,