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.
This commit is contained in:
parent
7b3574e6ee
commit
5a066fbc6c
|
@ -142,7 +142,7 @@ impl<'a, 'b, 'c, DeviceT: Device + 'a> Interface<'a, 'b, 'c, DeviceT> {
|
||||||
Ok(response) => response,
|
Ok(response) => response,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
net_debug!("cannot process ingress packet: {}", err);
|
net_debug!("cannot process ingress packet: {}", err);
|
||||||
continue
|
return Err(err)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
processed_any = true;
|
processed_any = true;
|
||||||
|
@ -151,7 +151,7 @@ impl<'a, 'b, 'c, DeviceT: Device + 'a> Interface<'a, 'b, 'c, DeviceT> {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
net_debug!("cannot dispatch response packet: {}", err);
|
net_debug!("cannot dispatch response packet: {}", err);
|
||||||
continue
|
return Err(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -185,8 +185,10 @@ impl<'a, 'b, 'c, DeviceT: Device + 'a> Interface<'a, 'b, 'c, DeviceT> {
|
||||||
};
|
};
|
||||||
match (device_result, socket_result) {
|
match (device_result, socket_result) {
|
||||||
(Ok(()), Err(Error::Exhausted)) => (), // nothing to transmit
|
(Ok(()), Err(Error::Exhausted)) => (), // nothing to transmit
|
||||||
(Err(err), _) | (_, Err(err)) =>
|
(Err(err), _) | (_, Err(err)) => {
|
||||||
net_debug!("cannot dispatch egress packet: {}", err),
|
net_debug!("cannot dispatch egress packet: {}", err);
|
||||||
|
return Err(err)
|
||||||
|
}
|
||||||
(Ok(()), Ok(())) => ()
|
(Ok(()), Ok(())) => ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue