From 3e124ef482ab0d87e7b758d7d4e29c4e8fa5c7b2 Mon Sep 17 00:00:00 2001 From: Michal Podhradsky Date: Fri, 22 Jun 2018 10:47:00 -0700 Subject: [PATCH] Log and print error for all examples --- examples/benchmark.rs | 8 +++++++- examples/httpclient.rs | 7 ++++++- examples/ping.rs | 8 +++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/examples/benchmark.rs b/examples/benchmark.rs index 4ccff15..90a36d8 100644 --- a/examples/benchmark.rs +++ b/examples/benchmark.rs @@ -108,7 +108,13 @@ fn main() { let mut processed = 0; while !CLIENT_DONE.load(Ordering::SeqCst) { 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); + } + } + // tcp:1234: emit data { diff --git a/examples/httpclient.rs b/examples/httpclient.rs index b007d44..7ac9ef7 100644 --- a/examples/httpclient.rs +++ b/examples/httpclient.rs @@ -66,7 +66,12 @@ fn main() { 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::(tcp_handle); diff --git a/examples/ping.rs b/examples/ping.rs index 8f76bf9..4788326 100644 --- a/examples/ping.rs +++ b/examples/ping.rs @@ -121,7 +121,13 @@ fn main() { let ident = 0x22b; loop { - iface.poll(&mut sockets, Instant::now()).unwrap(); + let timestamp = Instant::now(); + match iface.poll(&mut sockets, timestamp) { + Ok(_) => {}, + Err(e) => { + debug!("poll error: {}",e); + } + } { let timestamp = Instant::now();