diff options
Diffstat (limited to 'src/csharp/Grpc.Core/Internal/ServerCallHandler.cs')
-rw-r--r-- | src/csharp/Grpc.Core/Internal/ServerCallHandler.cs | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs index 59f4c5727c..0ade701a53 100644 --- a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs +++ b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs @@ -78,13 +78,13 @@ namespace Grpc.Core.Internal var context = HandlerUtils.NewContext(newRpc, asyncCall.Peer, responseStream, asyncCall.CancellationToken); try { - Preconditions.CheckArgument(await requestStream.MoveNext()); + Preconditions.CheckArgument(await requestStream.MoveNext().ConfigureAwait(false)); var request = requestStream.Current; // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. - Preconditions.CheckArgument(!await requestStream.MoveNext()); - var result = await handler(request, context); + Preconditions.CheckArgument(!await requestStream.MoveNext().ConfigureAwait(false)); + var result = await handler(request, context).ConfigureAwait(false); status = context.Status; - await responseStream.WriteAsync(result); + await responseStream.WriteAsync(result).ConfigureAwait(false); } catch (Exception e) { @@ -93,13 +93,13 @@ namespace Grpc.Core.Internal } try { - await responseStream.WriteStatusAsync(status, context.ResponseTrailers); + await responseStream.WriteStatusAsync(status, context.ResponseTrailers).ConfigureAwait(false); } catch (OperationCanceledException) { // Call has been already cancelled. } - await finishedTask; + await finishedTask.ConfigureAwait(false); } } @@ -134,11 +134,11 @@ namespace Grpc.Core.Internal var context = HandlerUtils.NewContext(newRpc, asyncCall.Peer, responseStream, asyncCall.CancellationToken); try { - Preconditions.CheckArgument(await requestStream.MoveNext()); + Preconditions.CheckArgument(await requestStream.MoveNext().ConfigureAwait(false)); var request = requestStream.Current; // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. - Preconditions.CheckArgument(!await requestStream.MoveNext()); - await handler(request, responseStream, context); + Preconditions.CheckArgument(!await requestStream.MoveNext().ConfigureAwait(false)); + await handler(request, responseStream, context).ConfigureAwait(false); status = context.Status; } catch (Exception e) @@ -149,13 +149,13 @@ namespace Grpc.Core.Internal try { - await responseStream.WriteStatusAsync(status, context.ResponseTrailers); + await responseStream.WriteStatusAsync(status, context.ResponseTrailers).ConfigureAwait(false); } catch (OperationCanceledException) { // Call has been already cancelled. } - await finishedTask; + await finishedTask.ConfigureAwait(false); } } @@ -190,11 +190,11 @@ namespace Grpc.Core.Internal var context = HandlerUtils.NewContext(newRpc, asyncCall.Peer, responseStream, asyncCall.CancellationToken); try { - var result = await handler(requestStream, context); + var result = await handler(requestStream, context).ConfigureAwait(false); status = context.Status; try { - await responseStream.WriteAsync(result); + await responseStream.WriteAsync(result).ConfigureAwait(false); } catch (OperationCanceledException) { @@ -209,13 +209,13 @@ namespace Grpc.Core.Internal try { - await responseStream.WriteStatusAsync(status, context.ResponseTrailers); + await responseStream.WriteStatusAsync(status, context.ResponseTrailers).ConfigureAwait(false); } catch (OperationCanceledException) { // Call has been already cancelled. } - await finishedTask; + await finishedTask.ConfigureAwait(false); } } @@ -250,7 +250,7 @@ namespace Grpc.Core.Internal var context = HandlerUtils.NewContext(newRpc, asyncCall.Peer, responseStream, asyncCall.CancellationToken); try { - await handler(requestStream, responseStream, context); + await handler(requestStream, responseStream, context).ConfigureAwait(false); status = context.Status; } catch (Exception e) @@ -260,13 +260,13 @@ namespace Grpc.Core.Internal } try { - await responseStream.WriteStatusAsync(status, context.ResponseTrailers); + await responseStream.WriteStatusAsync(status, context.ResponseTrailers).ConfigureAwait(false); } catch (OperationCanceledException) { // Call has been already cancelled. } - await finishedTask; + await finishedTask.ConfigureAwait(false); } } @@ -284,8 +284,8 @@ namespace Grpc.Core.Internal var finishedTask = asyncCall.ServerSideCallAsync(); var responseStream = new ServerResponseStream<byte[], byte[]>(asyncCall); - await responseStream.WriteStatusAsync(new Status(StatusCode.Unimplemented, "No such method."), Metadata.Empty); - await finishedTask; + await responseStream.WriteStatusAsync(new Status(StatusCode.Unimplemented, "No such method."), Metadata.Empty).ConfigureAwait(false); + await finishedTask.ConfigureAwait(false); } } |