|
|
|
@ -152,8 +152,11 @@ namespace Grpc.Core |
|
|
|
|
"Shutdown is a terminal state. No further state changes can occur."); |
|
|
|
|
var tcs = new TaskCompletionSource<object>(); |
|
|
|
|
var deadlineTimespec = deadline.HasValue ? Timespec.FromDateTime(deadline.Value) : Timespec.InfFuture; |
|
|
|
|
lock (myLock) |
|
|
|
|
{ |
|
|
|
|
// pass "tcs" as "state" for WatchConnectivityStateHandler. |
|
|
|
|
handle.WatchConnectivityState(lastObservedState, deadlineTimespec, completionQueue, WatchConnectivityStateHandler, tcs); |
|
|
|
|
} |
|
|
|
|
return tcs.Task; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -236,7 +239,10 @@ namespace Grpc.Core |
|
|
|
|
Logger.Warning("Channel shutdown was called but there are still {0} active calls for that channel.", activeCallCount); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
lock (myLock) |
|
|
|
|
{ |
|
|
|
|
handle.Dispose(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await Task.WhenAll(GrpcEnvironment.ReleaseAsync(), connectivityWatcherTask).ConfigureAwait(false); |
|
|
|
|
} |
|
|
|
@ -284,9 +290,12 @@ namespace Grpc.Core |
|
|
|
|
private ChannelState GetConnectivityState(bool tryToConnect) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
lock (myLock) |
|
|
|
|
{ |
|
|
|
|
return handle.CheckConnectivityState(tryToConnect); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (ObjectDisposedException) |
|
|
|
|
{ |
|
|
|
|
return ChannelState.Shutdown; |
|
|
|
|