From 035de6f3ff7bae31dce25b55e822f75b46ebe047 Mon Sep 17 00:00:00 2001 From: kbleeke Date: Wed, 22 Feb 2023 14:45:17 +0100 Subject: [PATCH] embassy-net: add flush to TcpSocket and TcpWriter as an inherent method --- embassy-net/src/tcp.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/embassy-net/src/tcp.rs b/embassy-net/src/tcp.rs index b9e494fc..c3d8764b 100644 --- a/embassy-net/src/tcp.rs +++ b/embassy-net/src/tcp.rs @@ -63,6 +63,10 @@ impl<'a> TcpWriter<'a> { pub async fn write(&mut self, buf: &[u8]) -> Result { self.io.write(buf).await } + + pub async fn flush(&mut self) -> Result<(), Error> { + self.io.flush().await + } } impl<'a> TcpSocket<'a> { @@ -146,6 +150,10 @@ impl<'a> TcpSocket<'a> { self.io.write(buf).await } + pub async fn flush(&mut self) -> Result<(), Error> { + self.io.flush().await + } + pub fn set_timeout(&mut self, duration: Option) { self.io.with_mut(|s, _| s.set_timeout(duration)) }