@@ -282,15 +282,15 @@ internal void SetProtocol(RedisProtocol value)
282282 }
283283
284284 [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Microsoft.Usage" , "CA2202:Do not dispose objects multiple times" , Justification = "Trust me yo" ) ]
285- internal void Shutdown ( )
285+ internal void Shutdown ( ConnectionFailureType failureType = ConnectionFailureType . ConnectionDisposed )
286286 {
287287 var ioPipe = Interlocked . Exchange ( ref _ioPipe , null ) ; // compare to the critical read
288288 var socket = Interlocked . Exchange ( ref _socket , null ) ;
289289
290290 if ( ioPipe != null )
291291 {
292292 Trace ( "Disconnecting..." ) ;
293- try { BridgeCouldBeNull ? . OnDisconnected ( ConnectionFailureType . ConnectionDisposed , this , out _ , out _ ) ; } catch { }
293+ try { BridgeCouldBeNull ? . OnDisconnected ( failureType , this , out _ , out _ ) ; } catch { }
294294 try { ioPipe . Input ? . CancelPendingRead ( ) ; } catch { }
295295 try { ioPipe . Input ? . Complete ( ) ; } catch { }
296296 try { ioPipe . Output ? . CancelPendingFlush ( ) ; } catch { }
@@ -777,6 +777,12 @@ internal int OnBridgeHeartbeat()
777777 multiplexer . OnAsyncTimeout ( ) ;
778778 result ++ ;
779779 }
780+ else if ( msg . IsHandshakeCompletion )
781+ {
782+ // Critical handshake validation timed out; note that this doesn't have a result-box,
783+ // so doesn't get timed out via the above.
784+ Shutdown ( ConnectionFailureType . UnableToConnect ) ;
785+ }
780786 }
781787 else
782788 {
0 commit comments