diff --git a/src/proto/server/testing.rs b/src/proto/server/testing.rs index 710a2a5..b0f54ea 100644 --- a/src/proto/server/testing.rs +++ b/src/proto/server/testing.rs @@ -296,9 +296,9 @@ impl Server { let (stream, peer_address) = result?; self.spawn_handler(stream, peer_address); }, - // If shutdown_rx's sender is dropped and we receive an error, we take - // that as a signal to shut down immediately too. result = &mut self.shutdown_rx => { + // If shutdown_rx's sender is dropped and we receive an error, we take + // that as a signal to shut down immediately too. match result.unwrap_or(ShutdownType::Immediate) { ShutdownType::LameDuck => break, ShutdownType::Immediate => { @@ -308,6 +308,14 @@ impl Server { break } } + }, + optional_result = self.result_rx.recv() => { + // We can never exhaust the result channel because we hold onto a + // sender in `self.result_tx`. + let result = optional_result.unwrap(); + + // Return an error if a handler returns an error. + result?; } ); }