Skip to content

Commit

Permalink
rename ChannelState.FatalFailure to ChannelState.Shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
jtattermusch committed Jun 6, 2016
1 parent 87ec3b7 commit 49fb84a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/csharp/Grpc.Core.Tests/ChannelTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void State_IdleAfterCreation()
public void WaitForStateChangedAsync_InvalidArgument()
{
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();
}

Expand Down Expand Up @@ -102,11 +102,11 @@ public async Task ShutdownTokenCancelledAfterShutdown()
}

[Test]
public async Task StateIsFatalFailureAfterShutdown()
public async Task StateIsShutdownAfterShutdown()
{
var channel = new Channel("localhost", ChannelCredentials.Insecure);
await channel.ShutdownAsync();
Assert.AreEqual(ChannelState.FatalFailure, channel.State);
Assert.AreEqual(ChannelState.Shutdown, channel.State);
}

[Test]
Expand Down
14 changes: 7 additions & 7 deletions src/csharp/Grpc.Core/Channel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public Channel(string host, int port, ChannelCredentials credentials, IEnumerabl

/// <summary>
/// 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>
public ChannelState State
{
Expand All @@ -121,8 +121,8 @@ public ChannelState State
/// </summary>
public Task WaitForStateChangedAsync(ChannelState lastObservedState, DateTime? deadline = null)
{
GrpcPreconditions.CheckArgument(lastObservedState != ChannelState.FatalFailure,
"FatalFailure is a terminal state. No further state changes can occur.");
GrpcPreconditions.CheckArgument(lastObservedState != ChannelState.Shutdown,
"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;
var handler = new BatchCompletionDelegate((success, ctx) =>
Expand Down Expand Up @@ -172,7 +172,7 @@ public CancellationToken ShutdownToken
/// <summary>
/// Allows explicitly requesting channel to connect without starting an RPC.
/// 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.
/// Starting an RPC on a new channel will request connection implicitly.
/// </summary>
Expand All @@ -182,9 +182,9 @@ public async Task ConnectAsync(DateTime? deadline = null)
var currentState = GetConnectivityState(true);
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);
currentState = GetConnectivityState(false);
Expand Down Expand Up @@ -264,7 +264,7 @@ private ChannelState GetConnectivityState(bool tryToConnect)
}
catch (ObjectDisposedException)
{
return ChannelState.FatalFailure;
return ChannelState.Shutdown;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/csharp/Grpc.Core/ChannelState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ public enum ChannelState
/// <summary>
/// Channel has seen a failure that it cannot recover from
/// </summary>
FatalFailure
Shutdown
}
}

0 comments on commit 49fb84a

Please sign in to comment.