Recent only relevant socket interrupt flags to not loose in-flight data
This commit is contained in:
parent
d58ab215b1
commit
3489574603
1 changed files with 6 additions and 2 deletions
|
|
@ -61,13 +61,15 @@ impl UdpSocket {
|
||||||
loop {
|
loop {
|
||||||
if self.socket.get_tx_read_pointer(bus)? == self.socket.get_tx_write_pointer(bus)? {
|
if self.socket.get_tx_read_pointer(bus)? == self.socket.get_tx_write_pointer(bus)? {
|
||||||
if self.socket.has_interrupt(bus, socketn::Interrupt::SendOk)? {
|
if self.socket.has_interrupt(bus, socketn::Interrupt::SendOk)? {
|
||||||
self.socket.reset_interrupt(bus, socketn::Interrupt::All)?;
|
self.socket
|
||||||
|
.reset_interrupt(bus, socketn::Interrupt::SendOk)?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
} else if self
|
} else if self
|
||||||
.socket
|
.socket
|
||||||
.has_interrupt(bus, socketn::Interrupt::Timeout)?
|
.has_interrupt(bus, socketn::Interrupt::Timeout)?
|
||||||
{
|
{
|
||||||
self.socket.reset_interrupt(bus, socketn::Interrupt::All)?;
|
self.socket
|
||||||
|
.reset_interrupt(bus, socketn::Interrupt::Timeout)?;
|
||||||
return Err(NbError::Other(UdpSocketError::WriteTimeout));
|
return Err(NbError::Other(UdpSocketError::WriteTimeout));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -125,6 +127,8 @@ impl UdpSocket {
|
||||||
.set_rx_read_pointer(bus, tx_write_pointer)
|
.set_rx_read_pointer(bus, tx_write_pointer)
|
||||||
.and_then(|_| self.socket.command(bus, socketn::Command::Receive))
|
.and_then(|_| self.socket.command(bus, socketn::Command::Receive))
|
||||||
.and_then(|_| self.socket.command(bus, socketn::Command::Open))?;
|
.and_then(|_| self.socket.command(bus, socketn::Command::Open))?;
|
||||||
|
self.socket
|
||||||
|
.reset_interrupt(bus, socketn::Interrupt::Receive)?;
|
||||||
Ok((packet_size, remote))
|
Ok((packet_size, remote))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue