Skip to content

Commit e488dca

Browse files
committed
Don't return shutdown errors during shutdown
1 parent 5f327ab commit e488dca

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tokio-boring/src/lib.rs

+13
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,19 @@ where
254254
return Poll::Pending;
255255
}
256256
Err(e) => {
257+
// If boring returns PROTOCOL_IS_SHUTDOWN then the connection
258+
// has already been shutdown and we can just return Ok(()), as
259+
// this was exactly what we wanted to do anyway.
260+
if e.code() == ErrorCode::SSL {
261+
if let Some(stack) = e.ssl_error() {
262+
if let Some(first) = stack.errors.first() {
263+
if first.code() as i32 == boring_sys::SSL_R_PROTOCOL_IS_SHUTDOWN {
264+
return Poll::Ready(Ok(()));
265+
}
266+
}
267+
}
268+
}
269+
257270
return Poll::Ready(Err(e
258271
.into_io_error()
259272
.unwrap_or_else(|e| io::Error::new(io::ErrorKind::Other, e))));

0 commit comments

Comments
 (0)