diff --git a/packages/centipede_worker/src/lib.rs b/packages/centipede_worker/src/lib.rs index 86d4865..fa7a60d 100644 --- a/packages/centipede_worker/src/lib.rs +++ b/packages/centipede_worker/src/lib.rs @@ -150,6 +150,7 @@ impl<'r> Worker<'r> { obligation.message().as_buffer(), &obligation.link().remote.into(), ) + .or_else(ignore_would_block) .map_err(Error::WriteSocket)?; write_buf = obligation.fulfill(); @@ -228,6 +229,14 @@ const TUN_TOKEN: mio::Token = mio::Token(usize::MAX); const PACKET_BUFFER_SIZE: usize = 65536; +fn ignore_would_block(e: io::Error) -> io::Result { + if e.kind() == io::ErrorKind::WouldBlock { + Ok(Default::default()) + } else { + Err(e) + } +} + #[derive(Debug, Error, Diagnostic)] pub enum Error { #[error("failed to poll for events")]