diff options
Diffstat (limited to 'embassy-net/src/raw.rs')
| -rw-r--r-- | embassy-net/src/raw.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/embassy-net/src/raw.rs b/embassy-net/src/raw.rs index 1098dc208..ace325a46 100644 --- a/embassy-net/src/raw.rs +++ b/embassy-net/src/raw.rs | |||
| @@ -108,6 +108,23 @@ impl<'a> RawSocket<'a> { | |||
| 108 | } | 108 | } |
| 109 | }) | 109 | }) |
| 110 | } | 110 | } |
| 111 | |||
| 112 | /// Flush the socket. | ||
| 113 | /// | ||
| 114 | /// This method will wait until the socket is flushed. | ||
| 115 | pub async fn flush(&mut self) { | ||
| 116 | poll_fn(move |cx| { | ||
| 117 | self.with_mut(|s, _| { | ||
| 118 | if s.send_queue() == 0 { | ||
| 119 | Poll::Ready(()) | ||
| 120 | } else { | ||
| 121 | s.register_send_waker(cx.waker()); | ||
| 122 | Poll::Pending | ||
| 123 | } | ||
| 124 | }) | ||
| 125 | }) | ||
| 126 | .await | ||
| 127 | } | ||
| 111 | } | 128 | } |
| 112 | 129 | ||
| 113 | impl Drop for RawSocket<'_> { | 130 | impl Drop for RawSocket<'_> { |
