Remove the error when stopping the network (#8671)

This commit is contained in:
Pierre Krieger
2018-05-22 06:35:13 +02:00
committed by Marek Kotewicz
parent ee41fa6f30
commit fe5f5b28d9
5 changed files with 14 additions and 16 deletions

View File

@@ -162,11 +162,13 @@ impl<Message> IoContext<Message> where Message: Send + Sync + 'static {
}
/// Unregister current IO handler.
pub fn unregister_handler(&self) -> Result<(), IoError> {
self.channel.send_io(IoMessage::RemoveHandler {
pub fn unregister_handler(&self) {
// `send_io` returns an error only if the channel is closed, which means that the
// background thread is no longer running. Therefore the handler is no longer active and
// can be considered as unregistered.
let _ = self.channel.send_io(IoMessage::RemoveHandler {
handler_id: self.handler,
})?;
Ok(())
});
}
}