diff options
| author | Russ Hewgill <[email protected]> | 2023-06-06 09:49:38 -0700 |
|---|---|---|
| committer | Russ Hewgill <[email protected]> | 2023-06-06 09:49:38 -0700 |
| commit | 2eb08b2dc92bc0393dc417de6ccdc039d30f6dd5 (patch) | |
| tree | b2637072417ec8eb86e197076b809c98f62215fc /embassy-net/src | |
| parent | a9fdd468d56e8359b0bfd14a31462e5e38090e25 (diff) | |
updated can_recv and may_recv to match the smoltcp functions.
Diffstat (limited to 'embassy-net/src')
| -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 7babb5293..515bbc5be 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> { |
