File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -3054,7 +3054,24 @@ impl<S: Read + Write> SslStream<S> {
3054
3054
match unsafe { ffi:: SSL_shutdown ( self . ssl . as_ptr ( ) ) } {
3055
3055
0 => Ok ( ShutdownResult :: Sent ) ,
3056
3056
1 => Ok ( ShutdownResult :: Received ) ,
3057
- n => Err ( self . make_error ( n) ) ,
3057
+ n => {
3058
+ let e = 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 Ok ( ShutdownResult :: Received ) ;
3068
+ }
3069
+ }
3070
+ }
3071
+ }
3072
+
3073
+ Err ( e)
3074
+ }
3058
3075
}
3059
3076
}
3060
3077
You can’t perform that action at this time.
0 commit comments