Drop context on MidHandshake success [tokio-native-tls] (#12)

This commit is contained in:
Kirill Fomichev 2020-05-07 20:55:37 +03:00 committed by GitHub
parent bd749ed734
commit 3c9b126993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -348,13 +348,16 @@ impl<S: AsyncRead + AsyncWrite + Unpin> Future for MidHandshake<S> {
s.get_mut().context = cx as *mut _ as *mut (); s.get_mut().context = cx as *mut _ as *mut ();
match s.handshake() { match s.handshake() {
Ok(stream) => Poll::Ready(Ok(TlsStream(stream))), Ok(mut s) => {
Err(HandshakeError::Failure(e)) => Poll::Ready(Err(e)), s.get_mut().context = null_mut();
Poll::Ready(Ok(TlsStream(s)))
}
Err(HandshakeError::WouldBlock(mut s)) => { Err(HandshakeError::WouldBlock(mut s)) => {
s.get_mut().context = null_mut(); s.get_mut().context = null_mut();
mut_self.0 = Some(s); mut_self.0 = Some(s);
Poll::Pending Poll::Pending
} }
Err(HandshakeError::Failure(e)) => Poll::Ready(Err(e)),
} }
} }
} }