diff options
author | Craig Tiller <ctiller@google.com> | 2016-04-05 10:47:31 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-04-05 10:47:31 -0700 |
commit | 52c85cecf365fb534827ac15780d803993693c46 (patch) | |
tree | 38e6a58cf315d88b5d10cfb35888f07d25ce1887 /src/core/lib | |
parent | f40a1972d00645ec9212f26085d6ed28cf3ea12c (diff) | |
parent | e6aa55c014364878bf539e95649b0e3327fd225f (diff) |
Merge github.com:grpc/grpc into optionalize_client_config
Diffstat (limited to 'src/core/lib')
-rw-r--r-- | src/core/lib/channel/http_client_filter.c | 10 | ||||
-rw-r--r-- | src/core/lib/channel/subchannel_call_holder.c | 5 | ||||
-rw-r--r-- | src/core/lib/channel/subchannel_call_holder.h | 1 | ||||
-rw-r--r-- | src/core/lib/surface/call.c | 10 | ||||
-rw-r--r-- | src/core/lib/transport/transport.h | 6 |
5 files changed, 19 insertions, 13 deletions
diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c index deba23e21f..211f537c69 100644 --- a/src/core/lib/channel/http_client_filter.c +++ b/src/core/lib/channel/http_client_filter.c @@ -111,10 +111,12 @@ static void hc_mutate_op(grpc_call_element *elem, elem); /* Send : prefixed headers, which have to be before any application layer headers. */ - grpc_metadata_batch_add_head(op->send_initial_metadata, &calld->method, - op->send_idempotent_request - ? GRPC_MDELEM_METHOD_PUT - : GRPC_MDELEM_METHOD_POST); + grpc_metadata_batch_add_head( + op->send_initial_metadata, &calld->method, + op->send_initial_metadata_flags & + GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST + ? GRPC_MDELEM_METHOD_PUT + : GRPC_MDELEM_METHOD_POST); grpc_metadata_batch_add_head(op->send_initial_metadata, &calld->scheme, channeld->static_scheme); grpc_metadata_batch_add_tail(op->send_initial_metadata, &calld->te_trailers, diff --git a/src/core/lib/channel/subchannel_call_holder.c b/src/core/lib/channel/subchannel_call_holder.c index 22f3679bf5..a2686a380a 100644 --- a/src/core/lib/channel/subchannel_call_holder.c +++ b/src/core/lib/channel/subchannel_call_holder.c @@ -127,7 +127,7 @@ retry: break; case GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL: holder->pick_subchannel(exec_ctx, holder->pick_subchannel_arg, NULL, - &holder->connected_subchannel, NULL); + 0, &holder->connected_subchannel, NULL); break; } gpr_mu_unlock(&holder->mu); @@ -145,7 +145,8 @@ retry: GRPC_CALL_STACK_REF(holder->owning_call, "pick_subchannel"); if (holder->pick_subchannel( exec_ctx, holder->pick_subchannel_arg, op->send_initial_metadata, - &holder->connected_subchannel, &holder->next_step)) { + op->send_initial_metadata_flags, &holder->connected_subchannel, + &holder->next_step)) { holder->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING; GRPC_CALL_STACK_UNREF(exec_ctx, holder->owning_call, "pick_subchannel"); } diff --git a/src/core/lib/channel/subchannel_call_holder.h b/src/core/lib/channel/subchannel_call_holder.h index 8e3a99e40b..2107a06cd9 100644 --- a/src/core/lib/channel/subchannel_call_holder.h +++ b/src/core/lib/channel/subchannel_call_holder.h @@ -42,6 +42,7 @@ called when the subchannel is available) */ typedef int (*grpc_subchannel_call_holder_pick_subchannel)( grpc_exec_ctx *exec_ctx, void *arg, grpc_metadata_batch *initial_metadata, + uint32_t initial_metadata_flags, grpc_connected_subchannel **connected_subchannel, grpc_closure *on_ready); typedef enum { diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 37cc724b53..ba94852f9a 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -81,11 +81,11 @@ typedef enum { /* Status came from the application layer overriding whatever the wire says */ STATUS_FROM_API_OVERRIDE = 0, - /* Status was created by some internal channel stack operation */ - STATUS_FROM_CORE, /* Status came from 'the wire' - or somewhere below the surface layer */ STATUS_FROM_WIRE, + /* Status was created by some internal channel stack operation */ + STATUS_FROM_CORE, /* Status came from the server sending status */ STATUS_FROM_SERVER_STATUS, STATUS_SOURCE_COUNT @@ -1110,6 +1110,9 @@ static void finish_batch(grpc_exec_ctx *exec_ctx, void *bctlp, bool success) { gpr_mu_lock(&call->mu); if (bctl->send_initial_metadata) { + if (!success) { + set_status_code(call, STATUS_FROM_CORE, GRPC_STATUS_UNAVAILABLE); + } grpc_metadata_batch_destroy( &call->metadata_batch[0 /* is_receiving */][0 /* is_trailing */]); } @@ -1232,8 +1235,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, call->metadata_batch[0][0].deadline = call->send_deadline; stream_op.send_initial_metadata = &call->metadata_batch[0 /* is_receiving */][0 /* is_trailing */]; - stream_op.send_idempotent_request = - (op->flags & GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) != 0; + stream_op.send_initial_metadata_flags = op->flags; break; case GRPC_OP_SEND_MESSAGE: if (!are_write_flags_valid(op->flags)) { diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 460e4dcedc..bb1120ee3a 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -101,9 +101,9 @@ typedef struct grpc_transport_stream_op { /** Send initial metadata to the peer, from the provided metadata batch. idempotent_request MUST be set if this is non-null */ grpc_metadata_batch *send_initial_metadata; - /** Iff send_initial_metadata != NULL, flags if this is an idempotent request - or not */ - bool send_idempotent_request; + /** Iff send_initial_metadata != NULL, flags associated with + send_initial_metadata: a bitfield of GRPC_INITIAL_METADATA_xxx */ + uint32_t send_initial_metadata_flags; /** Send trailing metadata to the peer, from the provided metadata batch. */ grpc_metadata_batch *send_trailing_metadata; |