simplify IServerCallHandler

pull/17889/head
Jan Tattermusch 6 years ago
parent 83a3b3b382
commit 8a33ae4c52
  1. 26
      src/csharp/Grpc.Core/Internal/ServerCallHandler.cs

@ -31,7 +31,6 @@ namespace Grpc.Core.Internal
internal interface IServerCallHandler internal interface IServerCallHandler
{ {
Task HandleCall(ServerRpcNew newRpc, CompletionQueueSafeHandle cq); Task HandleCall(ServerRpcNew newRpc, CompletionQueueSafeHandle cq);
IServerCallHandler Intercept(Interceptor interceptor);
} }
internal class UnaryServerCallHandler<TRequest, TResponse> : IServerCallHandler internal class UnaryServerCallHandler<TRequest, TResponse> : IServerCallHandler
@ -91,11 +90,6 @@ namespace Grpc.Core.Internal
} }
await finishedTask.ConfigureAwait(false); await finishedTask.ConfigureAwait(false);
} }
public IServerCallHandler Intercept(Interceptor interceptor)
{
return new UnaryServerCallHandler<TRequest, TResponse>(method, (request, context) => interceptor.UnaryServerHandler(request, context, handler));
}
} }
internal class ServerStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler internal class ServerStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler
@ -154,11 +148,6 @@ namespace Grpc.Core.Internal
} }
await finishedTask.ConfigureAwait(false); await finishedTask.ConfigureAwait(false);
} }
public IServerCallHandler Intercept(Interceptor interceptor)
{
return new ServerStreamingServerCallHandler<TRequest, TResponse>(method, (request, responseStream, context) => interceptor.ServerStreamingServerHandler(request, responseStream, context, handler));
}
} }
internal class ClientStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler internal class ClientStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler
@ -217,11 +206,6 @@ namespace Grpc.Core.Internal
} }
await finishedTask.ConfigureAwait(false); await finishedTask.ConfigureAwait(false);
} }
public IServerCallHandler Intercept(Interceptor interceptor)
{
return new ClientStreamingServerCallHandler<TRequest, TResponse>(method, (requestStream, context) => interceptor.ClientStreamingServerHandler(requestStream, context, handler));
}
} }
internal class DuplexStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler internal class DuplexStreamingServerCallHandler<TRequest, TResponse> : IServerCallHandler
@ -277,11 +261,6 @@ namespace Grpc.Core.Internal
} }
await finishedTask.ConfigureAwait(false); await finishedTask.ConfigureAwait(false);
} }
public IServerCallHandler Intercept(Interceptor interceptor)
{
return new DuplexStreamingServerCallHandler<TRequest, TResponse>(method, (requestStream, responseStream, context) => interceptor.DuplexStreamingServerHandler(requestStream, responseStream, context, handler));
}
} }
internal class UnimplementedMethodCallHandler : IServerCallHandler internal class UnimplementedMethodCallHandler : IServerCallHandler
@ -310,11 +289,6 @@ namespace Grpc.Core.Internal
{ {
return callHandlerImpl.HandleCall(newRpc, cq); return callHandlerImpl.HandleCall(newRpc, cq);
} }
public IServerCallHandler Intercept(Interceptor interceptor)
{
return this; // Do not intercept unimplemented methods.
}
} }
internal static class HandlerUtils internal static class HandlerUtils

Loading…
Cancel
Save