Keep accepting new connections after TLS handshake error. (#1134)

When a TLS handshake error occurs, the proxy just stops accepting
requests. It seems my expectations of how `Stream` handles errors
were wrong.

The test for this will be added in a separate PR after the
infrastructure needed for TLS testing is added. (This is a chicken
and egg problem.)

Signed-off-by: Brian Smith <brian@briansmith.org>
This commit is contained in:
Brian Smith 2018-06-15 14:22:58 -10:00 committed by GitHub
parent 24d54dc2d2
commit d50a65ba3f
1 changed files with 9 additions and 3 deletions

View File

@ -135,10 +135,16 @@ impl BoundPort {
None => Either::B(future::ok((Connection::new(Box::new(socket)), remote_addr))),
}
})
.or_else(|err| {
debug!("error handshaking: {}", err);
future::err(err)
.then(|r| {
future::ok(match r {
Ok(r) => Some(r),
Err(err) => {
debug!("error handshaking: {}", err);
None
}
})
})
.filter_map(|x| x)
.fold(initial, f)
)
.map(|_| ())