|
|
|
@ -244,9 +244,9 @@ static int fill_send_ops(grpc_call *call, grpc_transport_op *op); |
|
|
|
|
static void execute_op(grpc_call *call, grpc_transport_op *op); |
|
|
|
|
static void recv_metadata(grpc_call *call, grpc_metadata_batch *metadata); |
|
|
|
|
static void finish_read_ops(grpc_call *call); |
|
|
|
|
static grpc_call_error cancel_with_status( |
|
|
|
|
grpc_call *c, grpc_status_code status, const char *description, |
|
|
|
|
gpr_uint8 locked); |
|
|
|
|
static grpc_call_error cancel_with_status(grpc_call *c, grpc_status_code status, |
|
|
|
|
const char *description, |
|
|
|
|
gpr_uint8 locked); |
|
|
|
|
|
|
|
|
|
static void lock(grpc_call *call); |
|
|
|
|
static void unlock(grpc_call *call); |
|
|
|
@ -410,7 +410,8 @@ static void lock(grpc_call *call) { gpr_mu_lock(&call->mu); } |
|
|
|
|
static int need_more_data(grpc_call *call) { |
|
|
|
|
if (call->read_state == READ_STATE_STREAM_CLOSED) return 0; |
|
|
|
|
return is_op_live(call, GRPC_IOREQ_RECV_INITIAL_METADATA) || |
|
|
|
|
(is_op_live(call, GRPC_IOREQ_RECV_MESSAGE) && grpc_bbq_empty(&call->incoming_queue)) || |
|
|
|
|
(is_op_live(call, GRPC_IOREQ_RECV_MESSAGE) && |
|
|
|
|
grpc_bbq_empty(&call->incoming_queue)) || |
|
|
|
|
is_op_live(call, GRPC_IOREQ_RECV_TRAILING_METADATA) || |
|
|
|
|
is_op_live(call, GRPC_IOREQ_RECV_STATUS) || |
|
|
|
|
is_op_live(call, GRPC_IOREQ_RECV_STATUS_DETAILS) || |
|
|
|
@ -569,13 +570,13 @@ static void finish_live_ioreq_op(grpc_call *call, grpc_ioreq_op op, |
|
|
|
|
break; |
|
|
|
|
case GRPC_IOREQ_RECV_INITIAL_METADATA: |
|
|
|
|
GPR_SWAP(grpc_metadata_array, call->buffered_metadata[0], |
|
|
|
|
*call->request_data[GRPC_IOREQ_RECV_INITIAL_METADATA] |
|
|
|
|
.recv_metadata); |
|
|
|
|
*call->request_data[GRPC_IOREQ_RECV_INITIAL_METADATA] |
|
|
|
|
.recv_metadata); |
|
|
|
|
break; |
|
|
|
|
case GRPC_IOREQ_RECV_TRAILING_METADATA: |
|
|
|
|
GPR_SWAP(grpc_metadata_array, call->buffered_metadata[1], |
|
|
|
|
*call->request_data[GRPC_IOREQ_RECV_TRAILING_METADATA] |
|
|
|
|
.recv_metadata); |
|
|
|
|
*call->request_data[GRPC_IOREQ_RECV_TRAILING_METADATA] |
|
|
|
|
.recv_metadata); |
|
|
|
|
break; |
|
|
|
|
case GRPC_IOREQ_OP_COUNT: |
|
|
|
|
abort(); |
|
|
|
@ -689,9 +690,8 @@ static int add_slice_to_message(grpc_call *call, gpr_slice slice) { |
|
|
|
|
} |
|
|
|
|
/* we have to be reading a message to know what to do here */ |
|
|
|
|
if (!call->reading_message) { |
|
|
|
|
cancel_with_status( |
|
|
|
|
call, GRPC_STATUS_INVALID_ARGUMENT, |
|
|
|
|
"Received payload data while not reading a message", 1); |
|
|
|
|
cancel_with_status(call, GRPC_STATUS_INVALID_ARGUMENT, |
|
|
|
|
"Received payload data while not reading a message", 1); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
/* append the slice to the incoming buffer */ |
|
|
|
@ -1037,9 +1037,9 @@ grpc_call_error grpc_call_cancel_with_status(grpc_call *c, |
|
|
|
|
return cancel_with_status(c, status, description, 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static grpc_call_error cancel_with_status( |
|
|
|
|
grpc_call *c, grpc_status_code status, const char *description, |
|
|
|
|
gpr_uint8 locked) { |
|
|
|
|
static grpc_call_error cancel_with_status(grpc_call *c, grpc_status_code status, |
|
|
|
|
const char *description, |
|
|
|
|
gpr_uint8 locked) { |
|
|
|
|
grpc_transport_op op; |
|
|
|
|
grpc_mdstr *details = |
|
|
|
|
description ? grpc_mdstr_from_string(c->metadata_context, description) |
|
|
|
@ -1306,12 +1306,11 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, |
|
|
|
|
|
|
|
|
|
grpc_cq_begin_op(call->cq, call); |
|
|
|
|
|
|
|
|
|
return grpc_call_start_ioreq_and_call_back(call, reqs, out, finish_func, |
|
|
|
|
tag); |
|
|
|
|
return grpc_call_start_ioreq_and_call_back(call, reqs, out, finish_func, tag); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void grpc_call_context_set(grpc_call *call, grpc_context_index elem, void *value, |
|
|
|
|
void (*destroy)(void *value)) { |
|
|
|
|
void grpc_call_context_set(grpc_call *call, grpc_context_index elem, |
|
|
|
|
void *value, void (*destroy)(void *value)) { |
|
|
|
|
if (call->destroy_context[elem]) { |
|
|
|
|
call->destroy_context[elem](value); |
|
|
|
|
} |
|
|
|
|