File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4190,7 +4190,24 @@ impl<S: Read + Write> SslStream<S> {
41904190 match unsafe { ffi:: SSL_shutdown ( self . ssl . as_ptr ( ) ) } {
41914191 0 => Ok ( ShutdownResult :: Sent ) ,
41924192 1 => Ok ( ShutdownResult :: Received ) ,
4193- n => Err ( self . make_error ( n) ) ,
4193+ n => {
4194+ let e = self . make_error ( n) ;
4195+
4196+ // If boring returns PROTOCOL_IS_SHUTDOWN then the connection
4197+ // has already been shutdown and we can just return Ok(()), as
4198+ // this was exactly what we wanted to do anyway.
4199+ if e. code ( ) == ErrorCode :: SSL {
4200+ if let Some ( stack) = e. ssl_error ( ) {
4201+ if let Some ( first) = stack. errors ( ) . first ( ) {
4202+ if first. code ( ) as i32 == boring_sys:: SSL_R_PROTOCOL_IS_SHUTDOWN {
4203+ return Ok ( ShutdownResult :: Received ) ;
4204+ }
4205+ }
4206+ }
4207+ }
4208+
4209+ Err ( e)
4210+ }
41944211 }
41954212 }
41964213
You can’t perform that action at this time.
0 commit comments