Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
49fb84ab
Commit
49fb84ab
authored
8 years ago
by
Jan Tattermusch
Browse files
Options
Downloads
Patches
Plain Diff
rename ChannelState.FatalFailure to ChannelState.Shutdown
parent
87ec3b77
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/csharp/Grpc.Core.Tests/ChannelTest.cs
+3
-3
3 additions, 3 deletions
src/csharp/Grpc.Core.Tests/ChannelTest.cs
src/csharp/Grpc.Core/Channel.cs
+7
-7
7 additions, 7 deletions
src/csharp/Grpc.Core/Channel.cs
src/csharp/Grpc.Core/ChannelState.cs
+1
-1
1 addition, 1 deletion
src/csharp/Grpc.Core/ChannelState.cs
with
11 additions
and
11 deletions
src/csharp/Grpc.Core.Tests/ChannelTest.cs
+
3
−
3
View file @
49fb84ab
...
@@ -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
StateIs
FatalFailure
AfterShutdown
()
public
async
Task
StateIs
Shutdown
AfterShutdown
()
{
{
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
]
...
...
This diff is collapsed.
Click to expand it.
src/csharp/Grpc.Core/Channel.cs
+
7
−
7
View file @
49fb84ab
...
@@ -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
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/csharp/Grpc.Core/ChannelState.cs
+
1
−
1
View file @
49fb84ab
...
@@ -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
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment