Skip to content

Commit

Permalink
fix(send): NetworkConnection::send sends bytes via embedded_io_async:…
Browse files Browse the repository at this point in the history
…:Write::write_all and flush

Signed-off-by: Jad K. Haddad <[email protected]>
  • Loading branch information
JadKHaddad committed Oct 28, 2024
1 parent b4c7df8 commit b5ed04e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ where

/// Send the data from `buffer` via TCP connection.
pub async fn send(&mut self, buffer: &[u8]) -> Result<(), ReasonCode> {
let _ = self
.io
.write(buffer)
self.io
.write_all(buffer)
.await
.map_err(|_| ReasonCode::NetworkError)?;

self.io
.flush()
.await
.map_err(|_| ReasonCode::NetworkError)?;

Ok(())
}

Expand Down

0 comments on commit b5ed04e

Please sign in to comment.