throw RpcException from writes after finishing

pull/6641/head
Jan Tattermusch 9 years ago
parent a41c58c26d
commit 144a698f0c
  1. 13
      src/csharp/Grpc.Core/Internal/AsyncCall.cs
  2. 2
      src/csharp/Grpc.Core/Internal/AsyncCallBase.cs

@ -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
{ {
} }
protected void CheckSendingAllowed(bool allowFinished) protected virtual void CheckSendingAllowed(bool allowFinished)
{ {
GrpcPreconditions.CheckState(started); GrpcPreconditions.CheckState(started);
CheckNotCancelled(); CheckNotCancelled();

Loading…
Cancel
Save