From 649e5ce0235a38b33844be185f47a9dd47447af3 Mon Sep 17 00:00:00 2001 From: Colin Ihrig Date: Tue, 10 May 2022 08:27:08 -0400 Subject: fix: finish TLS handshake before shutting down (#14547) This commit ensures that the TLS handshake completes before attempting to close the connection. --- ext/net/ops_tls.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/net/ops_tls.rs b/ext/net/ops_tls.rs index ca922203c..8892ea0ac 100644 --- a/ext/net/ops_tls.rs +++ b/ext/net/ops_tls.rs @@ -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. -- cgit v1.2.3