diff options
Diffstat (limited to 'embassy-net')
| -rw-r--r-- | embassy-net/src/tcp.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs index 9dfbba32b..906102bbf 100644 --- a/embassy-net/src/tcp.rs +++ b/embassy-net/src/tcp.rs | |||
| @@ -98,6 +98,13 @@ impl<'a> TcpReader<'a> { | |||
| 98 | pub fn recv_capacity(&self) -> usize { | 98 | pub fn recv_capacity(&self) -> usize { |
| 99 | self.io.recv_capacity() | 99 | self.io.recv_capacity() |
| 100 | } | 100 | } |
| 101 | |||
| 102 | /// Return the amount of octets queued in the receive buffer. This value can be larger than | ||
| 103 | /// the slice read by the next `recv` or `peek` call because it includes all queued octets, | ||
| 104 | /// and not only the octets that may be returned as a contiguous slice. | ||
| 105 | pub fn recv_queue(&self) -> usize { | ||
| 106 | self.io.recv_queue() | ||
| 107 | } | ||
| 101 | } | 108 | } |
| 102 | 109 | ||
| 103 | impl<'a> TcpWriter<'a> { | 110 | impl<'a> TcpWriter<'a> { |
| @@ -132,6 +139,11 @@ impl<'a> TcpWriter<'a> { | |||
| 132 | pub fn send_capacity(&self) -> usize { | 139 | pub fn send_capacity(&self) -> usize { |
| 133 | self.io.send_capacity() | 140 | self.io.send_capacity() |
| 134 | } | 141 | } |
| 142 | |||
| 143 | /// Return the amount of octets queued in the transmit buffer. | ||
| 144 | pub fn send_queue(&self) -> usize { | ||
| 145 | self.io.send_queue() | ||
| 146 | } | ||
| 135 | } | 147 | } |
| 136 | 148 | ||
| 137 | impl<'a> TcpSocket<'a> { | 149 | impl<'a> TcpSocket<'a> { |
| @@ -163,6 +175,18 @@ impl<'a> TcpSocket<'a> { | |||
| 163 | self.io.send_capacity() | 175 | self.io.send_capacity() |
| 164 | } | 176 | } |
| 165 | 177 | ||
| 178 | /// Return the amount of octets queued in the transmit buffer. | ||
| 179 | pub fn send_queue(&self) -> usize { | ||
| 180 | self.io.send_queue() | ||
| 181 | } | ||
| 182 | |||
| 183 | /// Return the amount of octets queued in the receive buffer. This value can be larger than | ||
| 184 | /// the slice read by the next `recv` or `peek` call because it includes all queued octets, | ||
| 185 | /// and not only the octets that may be returned as a contiguous slice. | ||
| 186 | pub fn recv_queue(&self) -> usize { | ||
| 187 | self.io.recv_queue() | ||
| 188 | } | ||
| 189 | |||
| 166 | /// Call `f` with the largest contiguous slice of octets in the transmit buffer, | 190 | /// Call `f` with the largest contiguous slice of octets in the transmit buffer, |
| 167 | /// and enqueue the amount of elements returned by `f`. | 191 | /// and enqueue the amount of elements returned by `f`. |
| 168 | /// | 192 | /// |
| @@ -519,6 +543,14 @@ impl<'d> TcpIo<'d> { | |||
| 519 | fn send_capacity(&self) -> usize { | 543 | fn send_capacity(&self) -> usize { |
| 520 | self.with(|s, _| s.send_capacity()) | 544 | self.with(|s, _| s.send_capacity()) |
| 521 | } | 545 | } |
| 546 | |||
| 547 | fn send_queue(&self) -> usize { | ||
| 548 | self.with(|s, _| s.send_queue()) | ||
| 549 | } | ||
| 550 | |||
| 551 | fn recv_queue(&self) -> usize { | ||
| 552 | self.with(|s, _| s.recv_queue()) | ||
| 553 | } | ||
| 522 | } | 554 | } |
| 523 | 555 | ||
| 524 | mod embedded_io_impls { | 556 | mod embedded_io_impls { |
