File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3054,7 +3054,24 @@ impl<S: Read + Write> SslStream<S> {
30543054 match unsafe { ffi:: SSL_shutdown ( self . ssl . as_ptr ( ) ) } {
30553055 0 => Ok ( ShutdownResult :: Sent ) ,
30563056 1 => Ok ( ShutdownResult :: Received ) ,
3057- n => Err ( self . make_error ( n) ) ,
3057+ n => {
3058+ let err = self . make_error ( n) ;
3059+
3060+ // If boring returns PROTOCOL_IS_SHUTDOWN then the connection
3061+ // has already been shutdown and we can just return Ok(()), as
3062+ // this was exactly what we wanted to do anyway.
3063+ if e. code ( ) == ErrorCode :: SSL {
3064+ if let Some ( stack) = e. ssl_error ( ) {
3065+ if let Some ( first) = stack. errors . first ( ) {
3066+ if first. code ( ) as i32 == boring_sys:: SSL_R_PROTOCOL_IS_SHUTDOWN {
3067+ return Poll :: Ready ( Ok ( ShutdownResult :: Received ) ) ;
3068+ }
3069+ }
3070+ }
3071+ }
3072+
3073+ Err ( err)
3074+ }
30583075 }
30593076 }
30603077
You can’t perform that action at this time.
0 commit comments