Skip to content

Commit 1ece71a

Browse files
committedAug 30, 2017
Return from EthernetInterface::poll() on errors, don't swallow them.
We still print them into our debug log though, because it has more context; the caller may opt to ignore any poll errors and only use the smoltcp debug log as a, well, debugging aid, or it could print user-visible warnings to alert the user to unusual network conditions.
1 parent 79d8470 commit 1ece71a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

Diff for: ‎src/iface/ethernet.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl<'a, 'b, 'c, DeviceT: Device + 'a> Interface<'a, 'b, 'c, DeviceT> {
142142
Ok(response) => response,
143143
Err(err) => {
144144
net_debug!("cannot process ingress packet: {}", err);
145-
continue
145+
return Err(err)
146146
}
147147
};
148148
processed_any = true;
@@ -151,7 +151,7 @@ impl<'a, 'b, 'c, DeviceT: Device + 'a> Interface<'a, 'b, 'c, DeviceT> {
151151
Ok(()) => (),
152152
Err(err) => {
153153
net_debug!("cannot dispatch response packet: {}", err);
154-
continue
154+
return Err(err)
155155
}
156156
}
157157
}
@@ -185,8 +185,10 @@ impl<'a, 'b, 'c, DeviceT: Device + 'a> Interface<'a, 'b, 'c, DeviceT> {
185185
};
186186
match (device_result, socket_result) {
187187
(Ok(()), Err(Error::Exhausted)) => (), // nothing to transmit
188-
(Err(err), _) | (_, Err(err)) =>
189-
net_debug!("cannot dispatch egress packet: {}", err),
188+
(Err(err), _) | (_, Err(err)) => {
189+
net_debug!("cannot dispatch egress packet: {}", err);
190+
return Err(err)
191+
}
190192
(Ok(()), Ok(())) => ()
191193
}
192194
}

0 commit comments

Comments
 (0)
Please sign in to comment.