diff options
-rw-r--r-- | examples/tinyhttp.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/tinyhttp.rs b/examples/tinyhttp.rs index 2dd109de..1689a358 100644 --- a/examples/tinyhttp.rs +++ b/examples/tinyhttp.rs @@ -59,9 +59,10 @@ fn main() { } let mut next = 0; for socket in listener.incoming() { - let socket = socket.expect("failed to accept"); - channels[next].unbounded_send(socket).expect("worker thread died"); - next = (next + 1) % channels.len(); + if let Ok(socket) = socket { + channels[next].unbounded_send(socket).expect("worker thread died"); + next = (next + 1) % channels.len(); + } } } |