Skip to content

Commit

Permalink
fix freezing issue
Browse files Browse the repository at this point in the history
Signed-off-by: Wenqi Mou <wenqi.mou@dell.com>
  • Loading branch information
Wenqi Mou committed May 5, 2021
1 parent 887e17b commit fd37f9a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion wire_protocol/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ impl Connection for TlsConnection {
.expect("get connection")
.write_all(payload)
.await
.context(SendData {
endpoint: endpoint.clone(),
})?;

self.stream
.as_mut()
.expect("get connection")
.flush()
.await
.context(SendData { endpoint })?;
Ok(())
}
Expand Down Expand Up @@ -327,7 +336,10 @@ impl ConnectionWriteHalf for ConnectionWriteHalfTls {
async fn send_async(&mut self, payload: &[u8]) -> Result<(), ConnectionError> {
let endpoint = self.endpoint.clone();
if let Some(ref mut writer) = self.write_half {
writer.write_all(payload).await.context(SendData { endpoint })?;
writer.write_all(payload).await.context(SendData {
endpoint: endpoint.clone(),
})?;
writer.flush().await.context(SendData { endpoint })?;
} else {
panic!("should not try to write when write half is gone");
}
Expand Down

0 comments on commit fd37f9a

Please sign in to comment.