File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4069,7 +4069,24 @@ impl<S: Read + Write> SslStream<S> {
40694069 match unsafe { ffi:: SSL_shutdown ( self . ssl . as_ptr ( ) ) } {
40704070 0 => Ok ( ShutdownResult :: Sent ) ,
40714071 1 => Ok ( ShutdownResult :: Received ) ,
4072- n => Err ( self . make_error ( n) ) ,
4072+ n => {
4073+ let e = self . make_error ( n) ;
4074+
4075+ // If boring returns PROTOCOL_IS_SHUTDOWN then the connection
4076+ // has already been shutdown and we can just return Ok(()), as
4077+ // this was exactly what we wanted to do anyway.
4078+ if e. code ( ) == ErrorCode :: SSL {
4079+ if let Some ( stack) = e. ssl_error ( ) {
4080+ if let Some ( first) = stack. errors ( ) . first ( ) {
4081+ if first. code ( ) as i32 == boring_sys:: SSL_R_PROTOCOL_IS_SHUTDOWN {
4082+ return Ok ( ShutdownResult :: Received ) ;
4083+ }
4084+ }
4085+ }
4086+ }
4087+
4088+ Err ( e)
4089+ }
40734090 }
40744091 }
40754092
You can’t perform that action at this time.
0 commit comments