nal: Fix infinite loop when TX buffer is full

* For example, if the PHY linkup is down, instead of looping until resumption of the linkup, a write operation now closes the socket for re-connection in the future
This commit is contained in:
Harry Ho 2021-03-16 10:25:23 +08:00
parent 6de19f43cc
commit 2eadb652ff

View File

@ -247,6 +247,12 @@ where
};
match result {
Ok(num_bytes) => {
// If the buffer is completely filled, close the socket and
// return an error
if num_bytes == 0 {
write_error = true;
break;
}
// In case the buffer is filled up, push bytes into ethernet driver
if num_bytes != non_queued_bytes.len() {
self.update()?;