Don't unwrap accepted connections

Helps avoid spurious errors when testing.

Closes #277
This commit is contained in:
Alex Crichton
2017-11-06 08:23:11 -08:00
parent 25f30c91c4
commit 1fe55b2b55
+4 -3
View File
@@ -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();
}
}
}