You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Dispose context because it might have been created with a connect timeout.
385
423
// Want to clean up the connect timeout timer.
386
424
connectContext.Dispose();
425
+
426
+
// Subchannel could have been disposed while connect is running.
427
+
// If subchannel is shutting down then don't release semaphore to avoid ObjectDisposedException.
428
+
if(_state!=ConnectivityState.Shutdown)
429
+
{
430
+
_connectSemaphore.Release();
431
+
}
387
432
}
388
433
}
389
434
}
@@ -482,8 +527,12 @@ public void Dispose()
482
527
}
483
528
_stateChangedRegistrations.Clear();
484
529
485
-
CancelInProgressConnect();
486
-
_transport.Dispose();
530
+
lock(Lock)
531
+
{
532
+
CancelInProgressConnectUnsynchronized();
533
+
_transport.Dispose();
534
+
_connectSemaphore.Dispose();
535
+
}
487
536
}
488
537
}
489
538
@@ -505,7 +554,7 @@ internal static class SubchannelLog
505
554
LoggerMessage.Define<string,ConnectivityState>(LogLevel.Debug,newEventId(5,"ConnectionRequestedInNonIdleState"),"Subchannel id '{SubchannelId}' connection requested in non-idle state of {State}.");
LoggerMessage.Define<string,TimeSpan>(LogLevel.Trace,newEventId(7,"StartingConnectBackoff"),"Subchannel id '{SubchannelId}' starting connect backoff of {BackoffDuration}.");
@@ -514,7 +563,7 @@ internal static class SubchannelLog
514
563
LoggerMessage.Define<string>(LogLevel.Trace,newEventId(8,"ConnectBackoffInterrupted"),"Subchannel id '{SubchannelId}' connect backoff interrupted.");
LoggerMessage.Define<string>(LogLevel.Error,newEventId(10,"ConnectError"),"Subchannel id '{SubchannelId}' unexpected error while connecting to transport.");
@@ -546,6 +595,9 @@ internal static class SubchannelLog
LoggerMessage.Define<string,string>(LogLevel.Trace,newEventId(19,"AddressesUpdated"),"Subchannel id '{SubchannelId}' updated with addresses: {Addresses}");
LoggerMessage.Define<string>(LogLevel.Debug,newEventId(20,"QueuingConnect"),"Subchannel id '{SubchannelId}' queuing connect because a connect is already in progress.");
0 commit comments