node/runtime: Make `Runtime::run` more readable
A small refactoring that reorders arms of a match and makes them shorter by precise imports.
This commit is contained in:
parent
057edf55b8
commit
30701cc6fb
|
|
@ -418,13 +418,14 @@ impl<H: ReactionHandler> Runtime<H> {
|
||||||
if self.handle_events(tick, events) {
|
if self.handle_events(tick, events) {
|
||||||
// If a wake event was emitted, eagerly consume all control messages.
|
// If a wake event was emitted, eagerly consume all control messages.
|
||||||
loop {
|
loop {
|
||||||
|
use ControlMessage::*;
|
||||||
|
use TryRecvError::*;
|
||||||
|
|
||||||
match self.receiver.try_recv() {
|
match self.receiver.try_recv() {
|
||||||
Err(TryRecvError::Empty) => break,
|
Ok(Command(cmd)) => self.service.handle_command(*cmd),
|
||||||
Err(TryRecvError::Disconnected) => {
|
Ok(Shutdown) => return self.handle_shutdown(),
|
||||||
panic!("control channel disconnected unexpectedly")
|
Err(Empty) => break,
|
||||||
}
|
Err(Disconnected) => panic!("control channel disconnected unexpectedly"),
|
||||||
Ok(ControlMessage::Shutdown) => return self.handle_shutdown(),
|
|
||||||
Ok(ControlMessage::Command(cmd)) => self.service.handle_command(*cmd),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue