The simplest way to handle this is to put the GRPC_OP_RECV_MESSAGE into a separate batch. You can wait for the batch with the metadata, then wait for the message batch. If the server ends the call without sending a message, the message batch will end with a null message.
On Fri, Jul 24, 2020 at 10:59 AM Ram <[email protected]> wrote: > Any comments on the feasibility of this or other options to explore? Thank > you. > > On Wednesday, July 22, 2020 at 10:50:31 AM UTC-7 Ram wrote: > >> Team gRPC, >> >> We've a scenario where a gRPC client sets up all the operations and does >> a grpc_call_start_batch(), something like this: >> >> >> https://github.com/grpc/grpc/blob/master/test/core/end2end/tests/trailing_metadata.cc#L153 >> memset(ops, 0, sizeof(ops)); >> op = ops; >> op->op = GRPC_OP_SEND_INITIAL_METADATA; >> op->data.send_initial_metadata.count = 2; >> .... >> <snip> >> ...... >> op->op = GRPC_OP_RECV_INITIAL_METADATA; >> op->data.recv_initial_metadata.recv_initial_metadata = >> &initial_metadata_recv; >> op->flags = 0; >> op->reserved = nullptr; >> op++; >> op->op = GRPC_OP_RECV_MESSAGE; >> op->data.recv_message.recv_message = &response_payload_recv; >> op->flags = 0; >> op->reserved = nullptr; >> op++; >> .... >> <snip> >> ...... >> error = grpc_call_start_batch(c, ops, static_cast<size_t>(op - ops), >> tag(1), >> nullptr); >> >> GPR_ASSERT(GRPC_CALL_OK == error); >> >> In some scenarios, the server side sends only initial metadata whereas in >> some other scenarios it sends a message as well along with initial metadata >> and the client isn't aware of when one vs the other scenario happens. >> >> Is it possible to wake up client (i.e., event posted on the completion >> queue) to respond to both scenarios? I tried digging around in test subdir, >> couldn't find my scenario https://github.com/grpc/grpc/tree/master/test >> >> Any pointers or alternative options on this will be of help, thank you! >> >> Best, -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/6688642d-3807-4f94-995c-174b985281e8n%40googlegroups.com > <https://groups.google.com/d/msgid/grpc-io/6688642d-3807-4f94-995c-174b985281e8n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAPK2-4f4cP5qZyX9wVcgm%2BUfeHLQczrfz7O27320%2B72%2BW4sqvg%40mail.gmail.com.
smime.p7s
Description: S/MIME Cryptographic Signature
