Browse Source

change `respond` closure to propogate errors up

Ritik Mishra 2 years ago
parent
commit
f9d2bbad77
1 changed files with 7 additions and 4 deletions
  1. 7 4
      src/iface/interface.rs

+ 7 - 4
src/iface/interface.rs

@@ -1084,18 +1084,21 @@ impl<'a> Interface<'a> {
                 match device.transmit().ok_or(Error::Exhausted) {
                     Ok(_t) => {
                         #[cfg(feature = "proto-sixlowpan-fragmentation")]
-                        if let Err(_e) = inner.dispatch_ip(_t, response, Some(_out_packets)) {
-                            net_debug!("failed to dispatch IP: {}", _e);
+                        if let Err(e) = inner.dispatch_ip(_t, response, Some(_out_packets)) {
+                            net_debug!("failed to dispatch IP: {}", e);
+                            return Err(e);
                         }
 
                         #[cfg(not(feature = "proto-sixlowpan-fragmentation"))]
-                        if let Err(_e) = inner.dispatch_ip(_t, response, None) {
-                            net_debug!("failed to dispatch IP: {}", _e);
+                        if let Err(e) = inner.dispatch_ip(_t, response, None) {
+                            net_debug!("failed to dispatch IP: {}", e);
+                            return Err(e);
                         }
                         emitted_any = true;
                     }
                     Err(e) => {
                         net_debug!("failed to transmit IP: {}", e);
+                        return Err(e);
                     }
                 }