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

deduplicate send finished handler

parent febfd32a
No related branches found
No related tags found
No related merge requests found
...@@ -267,7 +267,7 @@ namespace Grpc.Core.Internal ...@@ -267,7 +267,7 @@ namespace Grpc.Core.Internal
halfcloseRequested = true; halfcloseRequested = true;
return Task.FromResult<object>(null); return Task.FromResult<object>(null);
} }
call.StartSendCloseFromClient(HandleSendCloseFromClientFinished); call.StartSendCloseFromClient(HandleSendFinished);
halfcloseRequested = true; halfcloseRequested = true;
streamingWriteTcs = new TaskCompletionSource<object>(); streamingWriteTcs = new TaskCompletionSource<object>();
......
...@@ -248,7 +248,7 @@ namespace Grpc.Core.Internal ...@@ -248,7 +248,7 @@ namespace Grpc.Core.Internal
} }
/// <summary> /// <summary>
/// Handles send completion. /// Handles send completion (including SendCloseFromClient).
/// </summary> /// </summary>
protected void HandleSendFinished(bool success) protected void HandleSendFinished(bool success)
{ {
...@@ -271,31 +271,6 @@ namespace Grpc.Core.Internal ...@@ -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> /// <summary>
/// Handles send status from server completion. /// Handles send status from server completion.
/// </summary> /// </summary>
......
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