Skip to content

Commit

Permalink
examples: remove the remaining panics on poll error.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Jul 31, 2018
1 parent 1fbcfb0 commit 185a0ca
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
7 changes: 6 additions & 1 deletion examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ fn main() {
let mut tcp_active = false;
loop {
let timestamp = Instant::now();
iface.poll(&mut sockets, timestamp).expect("poll error");
match iface.poll(&mut sockets, timestamp) {
Ok(_) => {},
Err(e) => {
debug!("poll error: {}", e);
}
}

{
let mut socket = sockets.get::<TcpSocket>(tcp_handle);
Expand Down
7 changes: 6 additions & 1 deletion examples/loopback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ fn main() {
let mut did_connect = false;
let mut done = false;
while !done && clock.elapsed() < Instant::from_millis(10_000) {
iface.poll(&mut socket_set, clock.elapsed()).expect("poll error");
match iface.poll(&mut socket_set, clock.elapsed()) {
Ok(_) => {},
Err(e) => {
debug!("poll error: {}", e);
}
}

{
let mut socket = socket_set.get::<TcpSocket>(server_handle);
Expand Down
2 changes: 1 addition & 1 deletion examples/ping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn main() {
match iface.poll(&mut sockets, timestamp) {
Ok(_) => {},
Err(e) => {
debug!("poll error: {}",e);
debug!("poll error: {}", e);
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn main() {
match iface.poll(&mut sockets, timestamp) {
Ok(_) => {},
Err(e) => {
debug!("poll error: {}",e);
debug!("poll error: {}", e);
}
}

Expand Down

0 comments on commit 185a0ca

Please sign in to comment.