Skip to content

Commit

Permalink
fix: finish TLS handshake before shutting down (denoland#14547)
Browse files Browse the repository at this point in the history
This commit ensures that the TLS handshake completes before
attempting to close the connection.
  • Loading branch information
cjihrig authored May 10, 2022
1 parent cb884de commit 649e5ce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ext/net/ops_tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ impl TlsStreamInner {
self.rd_state = State::StreamClosed;
}

// Wait for the handshake to complete.
ready!(self.poll_io(cx, Flow::Handshake))?;
// Send TLS 'CloseNotify' alert.
ready!(self.poll_shutdown(cx))?;
// Wait for 'CloseNotify', shut down TCP stream, wait for TCP FIN packet.
Expand Down

0 comments on commit 649e5ce

Please sign in to comment.