mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-23 00:00:10 +02:00
Don't unwrap accepted connections
Helps avoid spurious errors when testing. Closes #277
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user