diff options
author | Muxi Yan <mxyan@google.com> | 2017-03-13 09:53:31 -0700 |
---|---|---|
committer | Muxi Yan <mxyan@google.com> | 2017-03-13 09:53:31 -0700 |
commit | 04b06b7e325a8020c705ad9f4c3511f776d4b7b6 (patch) | |
tree | 7e3596605ade75b18bff6a0ac52b361885bfd3ac | |
parent | e6e7fd0c9963b10f46484cf1bc426667269ff94b (diff) |
Add comments
-rw-r--r-- | src/core/ext/transport/cronet/transport/cronet_transport.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c index 1759fe7ad2..fabfaf8a27 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.c +++ b/src/core/ext/transport/cronet/transport/cronet_transport.c @@ -152,12 +152,16 @@ struct write_state { struct op_state { bool state_op_done[OP_NUM_OPS]; bool state_callback_received[OP_NUM_OPS]; + /* A non-zero gRPC status code has been seen */ bool fail_state; + /* Transport is discarding all buffered messages */ bool flush_read; bool flush_cronet_when_ready; bool pending_write_for_trailer; bool pending_send_message; + /* User requested RECV_TRAILING_METADATA */ bool pending_recv_trailing_metadata; + /* Cronet has not issued a callback of a bidirectional read */ bool pending_read_from_cronet; grpc_error *cancel_error; /* data structure for storing data coming from server */ @@ -260,6 +264,13 @@ static void null_and_maybe_free_read_buffer(stream_obj *s) { } static void maybe_flush_read(stream_obj *s) { + /* To enter flush read state (discarding all the buffered messages in + * transport layer), two conditions must be satisfied: 1) non-zero grpc status + * has been received, and 2) an op requesting the status code + * (RECV_TRAILING_METADATA) is issued by the user. (See + * doc/status_ordering.md) */ + /* Whenever the evaluation of any of the two condition is changed, we check + * whether we should enter the flush read state. */ if (s->state.pending_recv_trailing_metadata && s->state.fail_state) { if (!s->state.flush_read) { CRONET_LOG(GPR_DEBUG, "%p: Flush read", s); |