|
|
@ -63,8 +63,8 @@ static grpc_metadata_array metadata_batch_to_md_array( |
|
|
|
grpc_slice value = GRPC_MDVALUE(md); |
|
|
|
grpc_slice value = GRPC_MDVALUE(md); |
|
|
|
if (result.count == result.capacity) { |
|
|
|
if (result.count == result.capacity) { |
|
|
|
result.capacity = GPR_MAX(result.capacity + 8, result.capacity * 2); |
|
|
|
result.capacity = GPR_MAX(result.capacity + 8, result.capacity * 2); |
|
|
|
result.metadata = |
|
|
|
result.metadata = (grpc_metadata *)gpr_realloc( |
|
|
|
gpr_realloc(result.metadata, result.capacity * sizeof(grpc_metadata)); |
|
|
|
result.metadata, result.capacity * sizeof(grpc_metadata)); |
|
|
|
} |
|
|
|
} |
|
|
|
usr_md = &result.metadata[result.count++]; |
|
|
|
usr_md = &result.metadata[result.count++]; |
|
|
|
usr_md->key = grpc_slice_ref_internal(key); |
|
|
|
usr_md->key = grpc_slice_ref_internal(key); |
|
|
@ -76,8 +76,8 @@ static grpc_metadata_array metadata_batch_to_md_array( |
|
|
|
static grpc_filtered_mdelem remove_consumed_md(grpc_exec_ctx *exec_ctx, |
|
|
|
static grpc_filtered_mdelem remove_consumed_md(grpc_exec_ctx *exec_ctx, |
|
|
|
void *user_data, |
|
|
|
void *user_data, |
|
|
|
grpc_mdelem md) { |
|
|
|
grpc_mdelem md) { |
|
|
|
grpc_call_element *elem = user_data; |
|
|
|
grpc_call_element *elem = (grpc_call_element *)user_data; |
|
|
|
call_data *calld = elem->call_data; |
|
|
|
call_data *calld = (call_data *)elem->call_data; |
|
|
|
size_t i; |
|
|
|
size_t i; |
|
|
|
for (i = 0; i < calld->num_consumed_md; i++) { |
|
|
|
for (i = 0; i < calld->num_consumed_md; i++) { |
|
|
|
const grpc_metadata *consumed_md = &calld->consumed_md[i]; |
|
|
|
const grpc_metadata *consumed_md = &calld->consumed_md[i]; |
|
|
@ -95,7 +95,7 @@ static void on_md_processing_done_inner(grpc_exec_ctx *exec_ctx, |
|
|
|
const grpc_metadata *response_md, |
|
|
|
const grpc_metadata *response_md, |
|
|
|
size_t num_response_md, |
|
|
|
size_t num_response_md, |
|
|
|
grpc_error *error) { |
|
|
|
grpc_error *error) { |
|
|
|
call_data *calld = elem->call_data; |
|
|
|
call_data *calld = (call_data *)elem->call_data; |
|
|
|
grpc_transport_stream_op_batch *batch = calld->recv_initial_metadata_batch; |
|
|
|
grpc_transport_stream_op_batch *batch = calld->recv_initial_metadata_batch; |
|
|
|
/* TODO(jboeuf): Implement support for response_md. */ |
|
|
|
/* TODO(jboeuf): Implement support for response_md. */ |
|
|
|
if (response_md != NULL && num_response_md > 0) { |
|
|
|
if (response_md != NULL && num_response_md > 0) { |
|
|
@ -119,8 +119,8 @@ static void on_md_processing_done( |
|
|
|
void *user_data, const grpc_metadata *consumed_md, size_t num_consumed_md, |
|
|
|
void *user_data, const grpc_metadata *consumed_md, size_t num_consumed_md, |
|
|
|
const grpc_metadata *response_md, size_t num_response_md, |
|
|
|
const grpc_metadata *response_md, size_t num_response_md, |
|
|
|
grpc_status_code status, const char *error_details) { |
|
|
|
grpc_status_code status, const char *error_details) { |
|
|
|
grpc_call_element *elem = user_data; |
|
|
|
grpc_call_element *elem = (grpc_call_element *)user_data; |
|
|
|
call_data *calld = elem->call_data; |
|
|
|
call_data *calld = (call_data *)elem->call_data; |
|
|
|
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
|
|
|
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; |
|
|
|
// If the call was not cancelled while we were in flight, process the result.
|
|
|
|
// If the call was not cancelled while we were in flight, process the result.
|
|
|
|
if (gpr_atm_full_cas(&calld->state, (gpr_atm)STATE_INIT, |
|
|
|
if (gpr_atm_full_cas(&calld->state, (gpr_atm)STATE_INIT, |
|
|
@ -149,7 +149,7 @@ static void on_md_processing_done( |
|
|
|
|
|
|
|
|
|
|
|
static void cancel_call(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { |
|
|
|
static void cancel_call(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { |
|
|
|
grpc_call_element *elem = (grpc_call_element *)arg; |
|
|
|
grpc_call_element *elem = (grpc_call_element *)arg; |
|
|
|
call_data *calld = elem->call_data; |
|
|
|
call_data *calld = (call_data *)elem->call_data; |
|
|
|
// If the result was not already processed, invoke the callback now.
|
|
|
|
// If the result was not already processed, invoke the callback now.
|
|
|
|
if (error != GRPC_ERROR_NONE && |
|
|
|
if (error != GRPC_ERROR_NONE && |
|
|
|
gpr_atm_full_cas(&calld->state, (gpr_atm)STATE_INIT, |
|
|
|
gpr_atm_full_cas(&calld->state, (gpr_atm)STATE_INIT, |
|
|
@ -163,8 +163,8 @@ static void cancel_call(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { |
|
|
|
static void recv_initial_metadata_ready(grpc_exec_ctx *exec_ctx, void *arg, |
|
|
|
static void recv_initial_metadata_ready(grpc_exec_ctx *exec_ctx, void *arg, |
|
|
|
grpc_error *error) { |
|
|
|
grpc_error *error) { |
|
|
|
grpc_call_element *elem = (grpc_call_element *)arg; |
|
|
|
grpc_call_element *elem = (grpc_call_element *)arg; |
|
|
|
channel_data *chand = elem->channel_data; |
|
|
|
channel_data *chand = (channel_data *)elem->channel_data; |
|
|
|
call_data *calld = elem->call_data; |
|
|
|
call_data *calld = (call_data *)elem->call_data; |
|
|
|
grpc_transport_stream_op_batch *batch = calld->recv_initial_metadata_batch; |
|
|
|
grpc_transport_stream_op_batch *batch = calld->recv_initial_metadata_batch; |
|
|
|
if (error == GRPC_ERROR_NONE) { |
|
|
|
if (error == GRPC_ERROR_NONE) { |
|
|
|
if (chand->creds != NULL && chand->creds->processor.process != NULL) { |
|
|
|
if (chand->creds != NULL && chand->creds->processor.process != NULL) { |
|
|
@ -191,7 +191,7 @@ static void recv_initial_metadata_ready(grpc_exec_ctx *exec_ctx, void *arg, |
|
|
|
static void auth_start_transport_stream_op_batch( |
|
|
|
static void auth_start_transport_stream_op_batch( |
|
|
|
grpc_exec_ctx *exec_ctx, grpc_call_element *elem, |
|
|
|
grpc_exec_ctx *exec_ctx, grpc_call_element *elem, |
|
|
|
grpc_transport_stream_op_batch *batch) { |
|
|
|
grpc_transport_stream_op_batch *batch) { |
|
|
|
call_data *calld = elem->call_data; |
|
|
|
call_data *calld = (call_data *)elem->call_data; |
|
|
|
if (batch->recv_initial_metadata) { |
|
|
|
if (batch->recv_initial_metadata) { |
|
|
|
// Inject our callback.
|
|
|
|
// Inject our callback.
|
|
|
|
calld->recv_initial_metadata_batch = batch; |
|
|
|
calld->recv_initial_metadata_batch = batch; |
|
|
@ -207,8 +207,8 @@ static void auth_start_transport_stream_op_batch( |
|
|
|
static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, |
|
|
|
static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, |
|
|
|
grpc_call_element *elem, |
|
|
|
grpc_call_element *elem, |
|
|
|
const grpc_call_element_args *args) { |
|
|
|
const grpc_call_element_args *args) { |
|
|
|
call_data *calld = elem->call_data; |
|
|
|
call_data *calld = (call_data *)elem->call_data; |
|
|
|
channel_data *chand = elem->channel_data; |
|
|
|
channel_data *chand = (channel_data *)elem->channel_data; |
|
|
|
calld->call_combiner = args->call_combiner; |
|
|
|
calld->call_combiner = args->call_combiner; |
|
|
|
calld->owning_call = args->call_stack; |
|
|
|
calld->owning_call = args->call_stack; |
|
|
|
GRPC_CLOSURE_INIT(&calld->recv_initial_metadata_ready, |
|
|
|
GRPC_CLOSURE_INIT(&calld->recv_initial_metadata_ready, |
|
|
@ -240,7 +240,7 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx, |
|
|
|
grpc_channel_element *elem, |
|
|
|
grpc_channel_element *elem, |
|
|
|
grpc_channel_element_args *args) { |
|
|
|
grpc_channel_element_args *args) { |
|
|
|
GPR_ASSERT(!args->is_last); |
|
|
|
GPR_ASSERT(!args->is_last); |
|
|
|
channel_data *chand = elem->channel_data; |
|
|
|
channel_data *chand = (channel_data *)elem->channel_data; |
|
|
|
grpc_auth_context *auth_context = |
|
|
|
grpc_auth_context *auth_context = |
|
|
|
grpc_find_auth_context_in_args(args->channel_args); |
|
|
|
grpc_find_auth_context_in_args(args->channel_args); |
|
|
|
GPR_ASSERT(auth_context != NULL); |
|
|
|
GPR_ASSERT(auth_context != NULL); |
|
|
@ -255,7 +255,7 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx, |
|
|
|
/* Destructor for channel data */ |
|
|
|
/* Destructor for channel data */ |
|
|
|
static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, |
|
|
|
static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, |
|
|
|
grpc_channel_element *elem) { |
|
|
|
grpc_channel_element *elem) { |
|
|
|
channel_data *chand = elem->channel_data; |
|
|
|
channel_data *chand = (channel_data *)elem->channel_data; |
|
|
|
GRPC_AUTH_CONTEXT_UNREF(chand->auth_context, "server_auth_filter"); |
|
|
|
GRPC_AUTH_CONTEXT_UNREF(chand->auth_context, "server_auth_filter"); |
|
|
|
grpc_server_credentials_unref(exec_ctx, chand->creds); |
|
|
|
grpc_server_credentials_unref(exec_ctx, chand->creds); |
|
|
|
} |
|
|
|
} |
|
|
|