Q: GRPC C++ - How to intercept and abort an RPC client request before the request is processed by the server service logic? I need to intercept an RPC request from a client, check a value in the metadata sent by the client and either abort any further processing or allow the RPC call to processed by the service logic.
Using AuthMetadataProcessor for secure servers seems to work nicely at aborting RPC calls before they reach the service logic. However, for insecure gRPC servers AuthMetadataProcessor does not exist yet.
I defined a custom interceptor to attempt this:
Attempt 1:
 class PeerInterceptor : public grpc::experimental::Interceptor {
   public:
     PeerInterceptor( grpc::experimental::ServerRpcInfo * info )
           : info_( info ) {}

     void Intercept( grpc::experimental::InterceptorBatchMethods * methods ) override {
        auto ctx = info_->server_context();
        if ( <valid metadata> ){
          ....
          methods->proceed()
        }
        else {
          ctx->TryCancel();   
        }
     }
   private:
     grpc::experimental::ServerRpcInfo * info_;
}

Right now calling TryCancel() on the server_context, seems to cause infinite calls to TryCancel() to be made, so I'm not convinced my understanding of TryCancel is correct.
Attempt 2:
Modifying the send status seems to just augment the return status to the client, but does not cause the RPC call to be aborted before it is processed by the service logic, so the RPC call still gets executed.
e.g:
methods->ModifySendStatus( grpc::Status( grpc::StatusCode::UNAUTHENTICATED, error ) )

Question:
What is the correct way to abort a gRPC call from within an interceptor and prevent the RPC request from being processed by the service logic?
