Hi, I'm assuming that you mean "...requirement for *the server* to close the *connection from the client* based on...". I strongly believe that by "closes the connection to the client" the author did not mean the whole HTTP/2 *connection* but only the given HTTP/2 *stream* on which the client made such a request. If my guess is correct, then all you need to do on your server is to send error response with the status set to FAILED_PRECONDITION in the trailing meta-data. I don't know C++ API, but in Java it's as simple as responseObserver.onError(Status.FAILED_PRECONDITION.asException()) and I guess in C++ there is a similar corresponding error sending mechanism as well.
Hope this helps :) On Thursday, August 19, 2021 at 11:53:27 AM UTC+7 Ram wrote: > Hello all, > > In the gRIBI protofile > <https://github.com/openconfig/gribi/blob/40372e8b4395934f2ebfd30c39615e42dc383f2c/v1/proto/service/gribi.proto#L108> > specification > there is a requirement to close the client connection based on some invalid > request parameters, it looks like that needs to be initiated by the network > element(server). > * // If the client redundancy mode is ALL_PRIMARY, but a client * > *// sends election_id, the network element closes the connection * > *// to the client and responds with FAILED_PRECONDITION in * > *// status.proto's `code` and sets ModifyRPCErrorDetails.reason * > *// to ELECTION_ID_IN_ALL_PRIMARY * > > Is there a mechanism available in gRPC C++ to achieve this? Is it possible > to get the client connection info from RPC context and initiate > disconnection upon invalid parameters? > > Thank you, -Ram. > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/640a258a-ba01-4669-a355-fa0bb25bd8d2n%40googlegroups.com.
