Преглед изворни кода

Log and print poll errors instead of crashing the server

Closes: #228
Approved by: dlrobertson
Michal Podhradsky пре 6 година
родитељ
комит
917f259bae
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      examples/server.rs

+ 6 - 1
examples/server.rs

@@ -74,7 +74,12 @@ fn main() {
     let mut tcp_6970_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);
+            }
+        }
 
         // udp:6969: respond "hello"
         {