Fix check for whether we should write to prevent infinite loop

pull/357/head
Craig Tiller 10 years ago
parent c12fee6a04
commit e2b2b1fb67
  1. 7
      src/core/surface/call.c

@ -445,17 +445,16 @@ static void finish_start_step(void *pc, grpc_op_error error) {
static send_action choose_send_action(grpc_call *call) { static send_action choose_send_action(grpc_call *call) {
switch (call->write_state) { switch (call->write_state) {
case WRITE_STATE_INITIAL: case WRITE_STATE_INITIAL:
if (call->request_set[GRPC_IOREQ_SEND_INITIAL_METADATA] != if (is_op_live(call, GRPC_IOREQ_SEND_INITIAL_METADATA)) {
REQSET_EMPTY) {
call->write_state = WRITE_STATE_STARTED; call->write_state = WRITE_STATE_STARTED;
return SEND_INITIAL_METADATA; return SEND_INITIAL_METADATA;
} }
return SEND_NOTHING; return SEND_NOTHING;
case WRITE_STATE_STARTED: case WRITE_STATE_STARTED:
if (call->request_set[GRPC_IOREQ_SEND_MESSAGE] != REQSET_EMPTY) { if (is_op_live(call, GRPC_IOREQ_SEND_MESSAGE)) {
return SEND_MESSAGE; return SEND_MESSAGE;
} }
if (call->request_set[GRPC_IOREQ_SEND_CLOSE] != REQSET_EMPTY) { if (is_op_live(call, GRPC_IOREQ_SEND_CLOSE)) {
call->write_state = WRITE_STATE_WRITE_CLOSED; call->write_state = WRITE_STATE_WRITE_CLOSED;
finish_ioreq_op(call, GRPC_IOREQ_SEND_TRAILING_METADATA, GRPC_OP_OK); finish_ioreq_op(call, GRPC_IOREQ_SEND_TRAILING_METADATA, GRPC_OP_OK);
finish_ioreq_op(call, GRPC_IOREQ_SEND_STATUS, GRPC_OP_OK); finish_ioreq_op(call, GRPC_IOREQ_SEND_STATUS, GRPC_OP_OK);

Loading…
Cancel
Save