aboutsummaryrefslogtreecommitdiff
path: root/embassy-net/src/tcp.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-06-08 19:38:15 +0200
committerDario Nieuwenhuis <[email protected]>2023-06-08 19:38:15 +0200
commit8a1d3d5c84baff267480ba761192fa4bd2045c59 (patch)
tree059562e7b564bcb8073032ceeb57b09d6f800bef /embassy-net/src/tcp.rs
parent2455fd4dbe4e874a9a200d3026f66d437449b04d (diff)
parentb68cf6c5c81d2bdc373e45c6adeedb5fa1241463 (diff)
Merge branch 'main' into v4-optional
Diffstat (limited to 'embassy-net/src/tcp.rs')
-rw-r--r--embassy-net/src/tcp.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs
index 52fee6883..367675b13 100644
--- a/embassy-net/src/tcp.rs
+++ b/embassy-net/src/tcp.rs
@@ -278,10 +278,18 @@ impl<'a> TcpSocket<'a> {
278 self.io.with(|s, _| s.may_send()) 278 self.io.with(|s, _| s.may_send())
279 } 279 }
280 280
281 /// Get whether the socket is ready to receive data, i.e. whether there is some pending data in the receive buffer. 281 /// return whether the recieve half of the full-duplex connection is open.
282 /// This function returns true if it’s possible to receive data from the remote endpoint.
283 /// It will return true while there is data in the receive buffer, and if there isn’t,
284 /// as long as the remote endpoint has not closed the connection.
282 pub fn may_recv(&self) -> bool { 285 pub fn may_recv(&self) -> bool {
283 self.io.with(|s, _| s.may_recv()) 286 self.io.with(|s, _| s.may_recv())
284 } 287 }
288
289 /// Get whether the socket is ready to receive data, i.e. whether there is some pending data in the receive buffer.
290 pub fn can_recv(&self) -> bool {
291 self.io.with(|s, _| s.can_recv())
292 }
285} 293}
286 294
287impl<'a> Drop for TcpSocket<'a> { 295impl<'a> Drop for TcpSocket<'a> {