Skip to content
Snippets Groups Projects
Commit 49fb84ab authored by Jan Tattermusch's avatar Jan Tattermusch
Browse files

rename ChannelState.FatalFailure to ChannelState.Shutdown

parent 87ec3b77
Branches
Tags
No related merge requests found
...@@ -71,7 +71,7 @@ namespace Grpc.Core.Tests ...@@ -71,7 +71,7 @@ namespace Grpc.Core.Tests
public void WaitForStateChangedAsync_InvalidArgument() public void WaitForStateChangedAsync_InvalidArgument()
{ {
var channel = new Channel("localhost", ChannelCredentials.Insecure); var channel = new Channel("localhost", ChannelCredentials.Insecure);
Assert.ThrowsAsync(typeof(ArgumentException), async () => await channel.WaitForStateChangedAsync(ChannelState.FatalFailure)); Assert.ThrowsAsync(typeof(ArgumentException), async () => await channel.WaitForStateChangedAsync(ChannelState.Shutdown));
channel.ShutdownAsync().Wait(); channel.ShutdownAsync().Wait();
} }
...@@ -102,11 +102,11 @@ namespace Grpc.Core.Tests ...@@ -102,11 +102,11 @@ namespace Grpc.Core.Tests
} }
[Test] [Test]
public async Task StateIsFatalFailureAfterShutdown() public async Task StateIsShutdownAfterShutdown()
{ {
var channel = new Channel("localhost", ChannelCredentials.Insecure); var channel = new Channel("localhost", ChannelCredentials.Insecure);
await channel.ShutdownAsync(); await channel.ShutdownAsync();
Assert.AreEqual(ChannelState.FatalFailure, channel.State); Assert.AreEqual(ChannelState.Shutdown, channel.State);
} }
[Test] [Test]
......
...@@ -104,7 +104,7 @@ namespace Grpc.Core ...@@ -104,7 +104,7 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Gets current connectivity state of this channel. /// Gets current connectivity state of this channel.
/// After channel is has been shutdown, <c>ChannelState.FatalFailure</c> will be returned. /// After channel is has been shutdown, <c>ChannelState.Shutdown</c> will be returned.
/// </summary> /// </summary>
public ChannelState State public ChannelState State
{ {
...@@ -121,8 +121,8 @@ namespace Grpc.Core ...@@ -121,8 +121,8 @@ namespace Grpc.Core
/// </summary> /// </summary>
public Task WaitForStateChangedAsync(ChannelState lastObservedState, DateTime? deadline = null) public Task WaitForStateChangedAsync(ChannelState lastObservedState, DateTime? deadline = null)
{ {
GrpcPreconditions.CheckArgument(lastObservedState != ChannelState.FatalFailure, GrpcPreconditions.CheckArgument(lastObservedState != ChannelState.Shutdown,
"FatalFailure is a terminal state. No further state changes can occur."); "Shutdown is a terminal state. No further state changes can occur.");
var tcs = new TaskCompletionSource<object>(); var tcs = new TaskCompletionSource<object>();
var deadlineTimespec = deadline.HasValue ? Timespec.FromDateTime(deadline.Value) : Timespec.InfFuture; var deadlineTimespec = deadline.HasValue ? Timespec.FromDateTime(deadline.Value) : Timespec.InfFuture;
var handler = new BatchCompletionDelegate((success, ctx) => var handler = new BatchCompletionDelegate((success, ctx) =>
...@@ -172,7 +172,7 @@ namespace Grpc.Core ...@@ -172,7 +172,7 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Allows explicitly requesting channel to connect without starting an RPC. /// Allows explicitly requesting channel to connect without starting an RPC.
/// Returned task completes once state Ready was seen. If the deadline is reached, /// Returned task completes once state Ready was seen. If the deadline is reached,
/// or channel enters the FatalFailure state, the task is cancelled. /// or channel enters the Shutdown state, the task is cancelled.
/// There is no need to call this explicitly unless your use case requires that. /// There is no need to call this explicitly unless your use case requires that.
/// Starting an RPC on a new channel will request connection implicitly. /// Starting an RPC on a new channel will request connection implicitly.
/// </summary> /// </summary>
...@@ -182,9 +182,9 @@ namespace Grpc.Core ...@@ -182,9 +182,9 @@ namespace Grpc.Core
var currentState = GetConnectivityState(true); var currentState = GetConnectivityState(true);
while (currentState != ChannelState.Ready) while (currentState != ChannelState.Ready)
{ {
if (currentState == ChannelState.FatalFailure) if (currentState == ChannelState.Shutdown)
{ {
throw new OperationCanceledException("Channel has reached FatalFailure state."); throw new OperationCanceledException("Channel has reached Shutdown state.");
} }
await WaitForStateChangedAsync(currentState, deadline).ConfigureAwait(false); await WaitForStateChangedAsync(currentState, deadline).ConfigureAwait(false);
currentState = GetConnectivityState(false); currentState = GetConnectivityState(false);
...@@ -264,7 +264,7 @@ namespace Grpc.Core ...@@ -264,7 +264,7 @@ namespace Grpc.Core
} }
catch (ObjectDisposedException) catch (ObjectDisposedException)
{ {
return ChannelState.FatalFailure; return ChannelState.Shutdown;
} }
} }
......
...@@ -64,6 +64,6 @@ namespace Grpc.Core ...@@ -64,6 +64,6 @@ namespace Grpc.Core
/// <summary> /// <summary>
/// Channel has seen a failure that it cannot recover from /// Channel has seen a failure that it cannot recover from
/// </summary> /// </summary>
FatalFailure Shutdown
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment