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

throw RpcException from writes after finishing

parent 6220033e
No related branches found
No related tags found
No related merge requests found
...@@ -443,6 +443,19 @@ namespace Grpc.Core.Internal ...@@ -443,6 +443,19 @@ namespace Grpc.Core.Internal
} }
} }
protected override void CheckSendingAllowed(bool allowFinished)
{
base.CheckSendingAllowed(true);
// throwing RpcException if we already received status on client
// side makes the most sense.
// Note that this throws even for StatusCode.OK.
if (!allowFinished && finishedStatus.HasValue)
{
throw new RpcException(finishedStatus.Value.Status);
}
}
/// <summary> /// <summary>
/// Handles receive status completion for calls with streaming response. /// Handles receive status completion for calls with streaming response.
/// </summary> /// </summary>
......
...@@ -213,7 +213,7 @@ namespace Grpc.Core.Internal ...@@ -213,7 +213,7 @@ namespace Grpc.Core.Internal
{ {
} }
protected void CheckSendingAllowed(bool allowFinished) protected virtual void CheckSendingAllowed(bool allowFinished)
{ {
GrpcPreconditions.CheckState(started); GrpcPreconditions.CheckState(started);
CheckNotCancelled(); CheckNotCancelled();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment