aboutsummaryrefslogtreecommitdiff
path: root/embassy-net
diff options
context:
space:
mode:
authorAnthony Grondin <[email protected]>2024-09-24 10:25:10 -0400
committerAnthony Grondin <[email protected]>2024-09-24 22:01:53 -0400
commite8da38772641ac19e5ded539144467efc9ed5a7b (patch)
tree5253a8c469753ad29e48c3b4c28422235eca3018 /embassy-net
parentae5b78b27a9c644850c905c197e216a6cd2ab0b9 (diff)
docs(embassy-net): Update can_send() and may_send() documentation to reflect actual behavior from smoltcp
Diffstat (limited to 'embassy-net')
-rw-r--r--embassy-net/src/tcp.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs
index bcddbc95b..fc66d6192 100644
--- a/embassy-net/src/tcp.rs
+++ b/embassy-net/src/tcp.rs
@@ -376,11 +376,25 @@ impl<'a> TcpSocket<'a> {
376 self.io.with_mut(|s, _| s.abort()) 376 self.io.with_mut(|s, _| s.abort())
377 } 377 }
378 378
379 /// Get whether the socket is ready to send data, i.e. whether there is space in the send buffer. 379 /// Return whether the transmit half of the full-duplex connection is open.
380 ///
381 /// This function returns true if it's possible to send data and have it arrive
382 /// to the remote endpoint. However, it does not make any guarantees about the state
383 /// of the transmit buffer, and even if it returns true, [write](#method.write) may
384 /// not be able to enqueue any octets.
385 ///
386 /// In terms of the TCP state machine, the socket must be in the `ESTABLISHED` or
387 /// `CLOSE-WAIT` state.
380 pub fn may_send(&self) -> bool { 388 pub fn may_send(&self) -> bool {
381 self.io.with(|s, _| s.may_send()) 389 self.io.with(|s, _| s.may_send())
382 } 390 }
383 391
392 /// Check whether the transmit half of the full-duplex connection is open
393 /// (see [may_send](#method.may_send)), and the transmit buffer is not full.
394 pub fn can_send(&self) -> bool {
395 self.io.with(|s, _| s.can_send())
396 }
397
384 /// return whether the receive half of the full-duplex connection is open. 398 /// return whether the receive half of the full-duplex connection is open.
385 /// This function returns true if it’s possible to receive data from the remote endpoint. 399 /// This function returns true if it’s possible to receive data from the remote endpoint.
386 /// It will return true while there is data in the receive buffer, and if there isn’t, 400 /// It will return true while there is data in the receive buffer, and if there isn’t,