aquatic_http network: avoid infinite loop case; minor other changes

This commit is contained in:
Joakim Frostegård 2020-07-04 15:04:31 +02:00
parent 656efc7d4e
commit 8ebfb1d0ce
2 changed files with 17 additions and 13 deletions

View file

@ -170,6 +170,8 @@ impl <'a>TlsHandshakeMachine {
Stream::TlsStream(stream)
);
::log::debug!("established tcp connection");
Ok(established)
},
Err(native_tls::HandshakeError::WouldBlock(handshake)) => {
@ -217,6 +219,8 @@ impl Connection {
TlsHandshakeMachine::new(tls_acceptor.clone(), tcp_stream)
)
} else {
::log::debug!("established tcp connection");
ConnectionInner::Established(
EstablishedConnection::new(Stream::TcpStream(tcp_stream))
)
@ -259,6 +263,7 @@ impl Connection {
}
}
/// Takes ownership since TlsStream needs ownership of TcpStream
#[inline]
pub fn get_in_progress(self) -> Option<TlsHandshakeMachine> {
if let ConnectionInner::InProgress(machine) = self.inner {