mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 08:12:30 +00:00
docs(embassy-net): Update can_send() and may_send() documentation to reflect actual behavior from smoltcp
This commit is contained in:
parent
ae5b78b27a
commit
e8da387726
@ -376,11 +376,25 @@ impl<'a> TcpSocket<'a> {
|
|||||||
self.io.with_mut(|s, _| s.abort())
|
self.io.with_mut(|s, _| s.abort())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get whether the socket is ready to send data, i.e. whether there is space in the send buffer.
|
/// Return whether the transmit half of the full-duplex connection is open.
|
||||||
|
///
|
||||||
|
/// This function returns true if it's possible to send data and have it arrive
|
||||||
|
/// to the remote endpoint. However, it does not make any guarantees about the state
|
||||||
|
/// of the transmit buffer, and even if it returns true, [write](#method.write) may
|
||||||
|
/// not be able to enqueue any octets.
|
||||||
|
///
|
||||||
|
/// In terms of the TCP state machine, the socket must be in the `ESTABLISHED` or
|
||||||
|
/// `CLOSE-WAIT` state.
|
||||||
pub fn may_send(&self) -> bool {
|
pub fn may_send(&self) -> bool {
|
||||||
self.io.with(|s, _| s.may_send())
|
self.io.with(|s, _| s.may_send())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check whether the transmit half of the full-duplex connection is open
|
||||||
|
/// (see [may_send](#method.may_send)), and the transmit buffer is not full.
|
||||||
|
pub fn can_send(&self) -> bool {
|
||||||
|
self.io.with(|s, _| s.can_send())
|
||||||
|
}
|
||||||
|
|
||||||
/// return whether the receive half of the full-duplex connection is open.
|
/// return whether the receive half of the full-duplex connection is open.
|
||||||
/// This function returns true if it’s possible to receive data from the remote endpoint.
|
/// This function returns true if it’s possible to receive data from the remote endpoint.
|
||||||
/// It will return true while there is data in the receive buffer, and if there isn’t,
|
/// It will return true while there is data in the receive buffer, and if there isn’t,
|
||||||
|
Loading…
Reference in New Issue
Block a user