diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-06-08 19:38:15 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-06-08 19:38:15 +0200 |
| commit | 8a1d3d5c84baff267480ba761192fa4bd2045c59 (patch) | |
| tree | 059562e7b564bcb8073032ceeb57b09d6f800bef /embassy-net | |
| parent | 2455fd4dbe4e874a9a200d3026f66d437449b04d (diff) | |
| parent | b68cf6c5c81d2bdc373e45c6adeedb5fa1241463 (diff) | |
Merge branch 'main' into v4-optional
Diffstat (limited to 'embassy-net')
| -rw-r--r-- | embassy-net/src/tcp.rs | 10 |
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 | ||
| 287 | impl<'a> Drop for TcpSocket<'a> { | 295 | impl<'a> Drop for TcpSocket<'a> { |
