|
|
|
@ -44,7 +44,7 @@ namespace Grpc.Core.Internal |
|
|
|
|
{ |
|
|
|
|
internal interface IServerCallHandler |
|
|
|
|
{ |
|
|
|
|
Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment); |
|
|
|
|
Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment, CompletionQueueSafeHandle cq); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
internal class UnaryServerCallHandler<TRequest, TResponse> : IServerCallHandler |
|
|
|
@ -62,14 +62,14 @@ namespace Grpc.Core.Internal |
|
|
|
|
this.handler = handler; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment) |
|
|
|
|
public async Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment, CompletionQueueSafeHandle cq) |
|
|
|
|
{ |
|
|
|
|
var asyncCall = new AsyncCallServer<TRequest, TResponse>( |
|
|
|
|
method.ResponseMarshaller.Serializer, |
|
|
|
|
method.RequestMarshaller.Deserializer, |
|
|
|
|
environment, newRpc.Server); |
|
|
|
|
|
|
|
|
|
asyncCall.Initialize(newRpc.Call); |
|
|
|
|
asyncCall.Initialize(newRpc.Call, cq); |
|
|
|
|
var finishedTask = asyncCall.ServerSideCallAsync(); |
|
|
|
|
var requestStream = new ServerRequestStream<TRequest, TResponse>(asyncCall); |
|
|
|
|
var responseStream = new ServerResponseStream<TRequest, TResponse>(asyncCall); |
|
|
|
@ -121,14 +121,14 @@ namespace Grpc.Core.Internal |
|
|
|
|
this.handler = handler; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment) |
|
|
|
|
public async Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment, CompletionQueueSafeHandle cq) |
|
|
|
|
{ |
|
|
|
|
var asyncCall = new AsyncCallServer<TRequest, TResponse>( |
|
|
|
|
method.ResponseMarshaller.Serializer, |
|
|
|
|
method.RequestMarshaller.Deserializer, |
|
|
|
|
environment, newRpc.Server); |
|
|
|
|
|
|
|
|
|
asyncCall.Initialize(newRpc.Call); |
|
|
|
|
asyncCall.Initialize(newRpc.Call, cq); |
|
|
|
|
var finishedTask = asyncCall.ServerSideCallAsync(); |
|
|
|
|
var requestStream = new ServerRequestStream<TRequest, TResponse>(asyncCall); |
|
|
|
|
var responseStream = new ServerResponseStream<TRequest, TResponse>(asyncCall); |
|
|
|
@ -179,14 +179,14 @@ namespace Grpc.Core.Internal |
|
|
|
|
this.handler = handler; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment) |
|
|
|
|
public async Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment, CompletionQueueSafeHandle cq) |
|
|
|
|
{ |
|
|
|
|
var asyncCall = new AsyncCallServer<TRequest, TResponse>( |
|
|
|
|
method.ResponseMarshaller.Serializer, |
|
|
|
|
method.RequestMarshaller.Deserializer, |
|
|
|
|
environment, newRpc.Server); |
|
|
|
|
|
|
|
|
|
asyncCall.Initialize(newRpc.Call); |
|
|
|
|
asyncCall.Initialize(newRpc.Call, cq); |
|
|
|
|
var finishedTask = asyncCall.ServerSideCallAsync(); |
|
|
|
|
var requestStream = new ServerRequestStream<TRequest, TResponse>(asyncCall); |
|
|
|
|
var responseStream = new ServerResponseStream<TRequest, TResponse>(asyncCall); |
|
|
|
@ -237,14 +237,14 @@ namespace Grpc.Core.Internal |
|
|
|
|
this.handler = handler; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment) |
|
|
|
|
public async Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment, CompletionQueueSafeHandle cq) |
|
|
|
|
{ |
|
|
|
|
var asyncCall = new AsyncCallServer<TRequest, TResponse>( |
|
|
|
|
method.ResponseMarshaller.Serializer, |
|
|
|
|
method.RequestMarshaller.Deserializer, |
|
|
|
|
environment, newRpc.Server); |
|
|
|
|
|
|
|
|
|
asyncCall.Initialize(newRpc.Call); |
|
|
|
|
asyncCall.Initialize(newRpc.Call, cq); |
|
|
|
|
var finishedTask = asyncCall.ServerSideCallAsync(); |
|
|
|
|
var requestStream = new ServerRequestStream<TRequest, TResponse>(asyncCall); |
|
|
|
|
var responseStream = new ServerResponseStream<TRequest, TResponse>(asyncCall); |
|
|
|
@ -281,13 +281,13 @@ namespace Grpc.Core.Internal |
|
|
|
|
{ |
|
|
|
|
public static readonly NoSuchMethodCallHandler Instance = new NoSuchMethodCallHandler(); |
|
|
|
|
|
|
|
|
|
public async Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment) |
|
|
|
|
public async Task HandleCall(ServerRpcNew newRpc, GrpcEnvironment environment, CompletionQueueSafeHandle cq) |
|
|
|
|
{ |
|
|
|
|
// We don't care about the payload type here. |
|
|
|
|
var asyncCall = new AsyncCallServer<byte[], byte[]>( |
|
|
|
|
(payload) => payload, (payload) => payload, environment, newRpc.Server); |
|
|
|
|
|
|
|
|
|
asyncCall.Initialize(newRpc.Call); |
|
|
|
|
asyncCall.Initialize(newRpc.Call, cq); |
|
|
|
|
var finishedTask = asyncCall.ServerSideCallAsync(); |
|
|
|
|
await asyncCall.SendStatusFromServerAsync(new Status(StatusCode.Unimplemented, ""), Metadata.Empty, null).ConfigureAwait(false); |
|
|
|
|
await finishedTask.ConfigureAwait(false); |
|
|
|
|