deduplicate send finished handler

pull/6908/head
Jan Tattermusch 9 years ago
parent febfd32af9
commit b8d50af3a5
  1. 2
      src/csharp/Grpc.Core/Internal/AsyncCall.cs
  2. 27
      src/csharp/Grpc.Core/Internal/AsyncCallBase.cs

@ -267,7 +267,7 @@ namespace Grpc.Core.Internal
halfcloseRequested = true;
return Task.FromResult<object>(null);
}
call.StartSendCloseFromClient(HandleSendCloseFromClientFinished);
call.StartSendCloseFromClient(HandleSendFinished);
halfcloseRequested = true;
streamingWriteTcs = new TaskCompletionSource<object>();

@ -248,7 +248,7 @@ namespace Grpc.Core.Internal
}
/// <summary>
/// Handles send completion.
/// Handles send completion (including SendCloseFromClient).
/// </summary>
protected void HandleSendFinished(bool success)
{
@ -271,31 +271,6 @@ namespace Grpc.Core.Internal
}
}
/// <summary>
/// Handles halfclose (send close from client) completion.
/// </summary>
protected void HandleSendCloseFromClientFinished(bool success)
{
TaskCompletionSource<object> origTcs = null;
lock (myLock)
{
origTcs = streamingWriteTcs;
streamingWriteTcs = null;
ReleaseResourcesIfPossible();
}
if (!success)
{
// TODO(jtattermusch): this method is same as HandleSendFinished (only the error message differs).
origTcs.SetException(new InvalidOperationException("Sending close from client has failed."));
}
else
{
origTcs.SetResult(null);
}
}
/// <summary>
/// Handles send status from server completion.
/// </summary>

Loading…
Cancel
Save