|
|
|
@ -850,16 +850,16 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, |
|
|
|
|
CRONET_LOG(GPR_DEBUG, "running: %p OP_RECV_INITIAL_METADATA", oas); |
|
|
|
|
if (stream_state->state_op_done[OP_CANCEL_ERROR]) { |
|
|
|
|
grpc_closure_sched(exec_ctx, stream_op->recv_initial_metadata_ready, |
|
|
|
|
GRPC_ERROR_CANCELLED, NULL); |
|
|
|
|
GRPC_ERROR_CANCELLED); |
|
|
|
|
} else if (stream_state->state_callback_received[OP_FAILED]) { |
|
|
|
|
grpc_closure_sched( |
|
|
|
|
exec_ctx, stream_op->recv_initial_metadata_ready, |
|
|
|
|
make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable."), NULL); |
|
|
|
|
make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable.")); |
|
|
|
|
} else { |
|
|
|
|
grpc_chttp2_incoming_metadata_buffer_publish( |
|
|
|
|
&oas->s->state.rs.initial_metadata, stream_op->recv_initial_metadata); |
|
|
|
|
grpc_closure_sched(exec_ctx, stream_op->recv_initial_metadata_ready, |
|
|
|
|
GRPC_ERROR_NONE, NULL); |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
} |
|
|
|
|
stream_state->state_op_done[OP_RECV_INITIAL_METADATA] = true; |
|
|
|
|
result = ACTION_TAKEN_NO_CALLBACK; |
|
|
|
@ -911,21 +911,21 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, |
|
|
|
|
if (stream_state->state_op_done[OP_CANCEL_ERROR]) { |
|
|
|
|
CRONET_LOG(GPR_DEBUG, "Stream is cancelled."); |
|
|
|
|
grpc_closure_sched(exec_ctx, stream_op->recv_message_ready, |
|
|
|
|
GRPC_ERROR_CANCELLED, NULL); |
|
|
|
|
GRPC_ERROR_CANCELLED); |
|
|
|
|
stream_state->state_op_done[OP_RECV_MESSAGE] = true; |
|
|
|
|
result = ACTION_TAKEN_NO_CALLBACK; |
|
|
|
|
} else if (stream_state->state_callback_received[OP_FAILED]) { |
|
|
|
|
CRONET_LOG(GPR_DEBUG, "Stream failed."); |
|
|
|
|
grpc_closure_sched( |
|
|
|
|
exec_ctx, stream_op->recv_message_ready, |
|
|
|
|
make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable."), NULL); |
|
|
|
|
make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable.")); |
|
|
|
|
stream_state->state_op_done[OP_RECV_MESSAGE] = true; |
|
|
|
|
result = ACTION_TAKEN_NO_CALLBACK; |
|
|
|
|
} else if (stream_state->rs.read_stream_closed == true) { |
|
|
|
|
/* No more data will be received */ |
|
|
|
|
CRONET_LOG(GPR_DEBUG, "read stream closed"); |
|
|
|
|
grpc_closure_sched(exec_ctx, stream_op->recv_message_ready, |
|
|
|
|
GRPC_ERROR_NONE, NULL); |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
stream_state->state_op_done[OP_RECV_MESSAGE] = true; |
|
|
|
|
oas->state.state_op_done[OP_RECV_MESSAGE] = true; |
|
|
|
|
result = ACTION_TAKEN_NO_CALLBACK; |
|
|
|
@ -959,7 +959,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, |
|
|
|
|
*((grpc_byte_buffer **)stream_op->recv_message) = |
|
|
|
|
(grpc_byte_buffer *)&stream_state->rs.sbs; |
|
|
|
|
grpc_closure_sched(exec_ctx, stream_op->recv_message_ready, |
|
|
|
|
GRPC_ERROR_NONE, NULL); |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
stream_state->state_op_done[OP_RECV_MESSAGE] = true; |
|
|
|
|
oas->state.state_op_done[OP_RECV_MESSAGE] = true; |
|
|
|
|
result = ACTION_TAKEN_NO_CALLBACK; |
|
|
|
@ -994,7 +994,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, |
|
|
|
|
*((grpc_byte_buffer **)stream_op->recv_message) = |
|
|
|
|
(grpc_byte_buffer *)&stream_state->rs.sbs; |
|
|
|
|
grpc_closure_sched(exec_ctx, stream_op->recv_message_ready, |
|
|
|
|
GRPC_ERROR_NONE, NULL); |
|
|
|
|
GRPC_ERROR_NONE); |
|
|
|
|
stream_state->state_op_done[OP_RECV_MESSAGE] = true; |
|
|
|
|
oas->state.state_op_done[OP_RECV_MESSAGE] = true; |
|
|
|
|
/* Do an extra read to trigger on_succeeded() callback in case connection
|
|
|
|
@ -1056,17 +1056,16 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx, |
|
|
|
|
CRONET_LOG(GPR_DEBUG, "running: %p OP_ON_COMPLETE", oas); |
|
|
|
|
if (stream_state->state_op_done[OP_CANCEL_ERROR]) { |
|
|
|
|
grpc_closure_sched(exec_ctx, stream_op->on_complete, |
|
|
|
|
GRPC_ERROR_REF(stream_state->cancel_error), NULL); |
|
|
|
|
GRPC_ERROR_REF(stream_state->cancel_error)); |
|
|
|
|
} else if (stream_state->state_callback_received[OP_FAILED]) { |
|
|
|
|
grpc_closure_sched( |
|
|
|
|
exec_ctx, stream_op->on_complete, |
|
|
|
|
make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable."), NULL); |
|
|
|
|
make_error_with_desc(GRPC_STATUS_UNAVAILABLE, "Unavailable.")); |
|
|
|
|
} else { |
|
|
|
|
/* All actions in this stream_op are complete. Call the on_complete
|
|
|
|
|
* callback |
|
|
|
|
*/ |
|
|
|
|
grpc_closure_sched(exec_ctx, stream_op->on_complete, GRPC_ERROR_NONE, |
|
|
|
|
NULL); |
|
|
|
|
grpc_closure_sched(exec_ctx, stream_op->on_complete, GRPC_ERROR_NONE); |
|
|
|
|
} |
|
|
|
|
oas->state.state_op_done[OP_ON_COMPLETE] = true; |
|
|
|
|
oas->done = true; |
|
|
|
|