Require Inbound setup handlers to provide a result
Rather than having them default to `Ok(())`, which is incorrect for some error handlers.
This commit is contained in:
parent
09c8c89462
commit
6679a124e3
|
|
@ -150,7 +150,9 @@ impl Service<zn::Request> for Inbound {
|
||||||
// and reporting unreadiness might cause unwanted load-shedding, since
|
// and reporting unreadiness might cause unwanted load-shedding, since
|
||||||
// the load-shed middleware is unable to distinguish being unready due
|
// the load-shed middleware is unable to distinguish being unready due
|
||||||
// to load from being unready while waiting on setup.
|
// to load from being unready while waiting on setup.
|
||||||
let mut result = Ok(());
|
|
||||||
|
// Every network_setup state handler must provide a result
|
||||||
|
let result;
|
||||||
|
|
||||||
self.network_setup = match self.take_setup() {
|
self.network_setup = match self.take_setup() {
|
||||||
Setup::AwaitingNetwork {
|
Setup::AwaitingNetwork {
|
||||||
|
|
@ -163,6 +165,7 @@ impl Service<zn::Request> for Inbound {
|
||||||
Timeout::new(verifier, BLOCK_VERIFY_TIMEOUT),
|
Timeout::new(verifier, BLOCK_VERIFY_TIMEOUT),
|
||||||
self.state.clone(),
|
self.state.clone(),
|
||||||
));
|
));
|
||||||
|
result = Ok(());
|
||||||
Setup::Initialized {
|
Setup::Initialized {
|
||||||
address_book,
|
address_book,
|
||||||
downloads,
|
downloads,
|
||||||
|
|
@ -170,6 +173,7 @@ impl Service<zn::Request> for Inbound {
|
||||||
}
|
}
|
||||||
Err(TryRecvError::Empty) => {
|
Err(TryRecvError::Empty) => {
|
||||||
// There's no setup data yet, so keep waiting for it
|
// There's no setup data yet, so keep waiting for it
|
||||||
|
result = Ok(());
|
||||||
Setup::AwaitingNetwork {
|
Setup::AwaitingNetwork {
|
||||||
network_setup,
|
network_setup,
|
||||||
verifier,
|
verifier,
|
||||||
|
|
@ -196,6 +200,8 @@ impl Service<zn::Request> for Inbound {
|
||||||
mut downloads,
|
mut downloads,
|
||||||
} => {
|
} => {
|
||||||
while let Poll::Ready(Some(_)) = downloads.as_mut().poll_next(cx) {}
|
while let Poll::Ready(Some(_)) = downloads.as_mut().poll_next(cx) {}
|
||||||
|
|
||||||
|
result = Ok(());
|
||||||
Setup::Initialized {
|
Setup::Initialized {
|
||||||
address_book,
|
address_book,
|
||||||
downloads,
|
downloads,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue