diff options
author | Craig Tiller <ctiller@google.com> | 2016-11-16 16:05:01 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-11-16 16:05:01 -0800 |
commit | 66b14c125ef7a792ce277021619e8a14a2619dda (patch) | |
tree | 53aa69cb045258a49bb4b974742030e900d5f9f5 /src/core/lib/transport | |
parent | 8cfe059dbc82bcfbd35647654a869369978b052e (diff) | |
parent | 1094c32f358cef7df323952c117a6773809019c0 (diff) |
Merge branch 'slice_interning' into eliminate_mdstr
Diffstat (limited to 'src/core/lib/transport')
-rw-r--r-- | src/core/lib/transport/connectivity_state.c | 3 | ||||
-rw-r--r-- | src/core/lib/transport/metadata.c | 7 | ||||
-rw-r--r-- | src/core/lib/transport/metadata.h | 4 | ||||
-rw-r--r-- | src/core/lib/transport/metadata_batch.c | 8 | ||||
-rw-r--r-- | src/core/lib/transport/metadata_batch.h | 3 | ||||
-rw-r--r-- | src/core/lib/transport/pid_controller.h | 2 | ||||
-rw-r--r-- | src/core/lib/transport/transport.c | 5 | ||||
-rw-r--r-- | src/core/lib/transport/transport.h | 5 | ||||
-rw-r--r-- | src/core/lib/transport/transport_impl.h | 3 |
9 files changed, 30 insertions, 10 deletions
diff --git a/src/core/lib/transport/connectivity_state.c b/src/core/lib/transport/connectivity_state.c index fdb5307814..89072879d9 100644 --- a/src/core/lib/transport/connectivity_state.c +++ b/src/core/lib/transport/connectivity_state.c @@ -43,6 +43,8 @@ int grpc_connectivity_state_trace = 0; const char *grpc_connectivity_state_name(grpc_connectivity_state state) { switch (state) { + case GRPC_CHANNEL_INIT: + return "INIT"; case GRPC_CHANNEL_IDLE: return "IDLE"; case GRPC_CHANNEL_CONNECTING: @@ -159,6 +161,7 @@ void grpc_connectivity_state_set(grpc_exec_ctx *exec_ctx, grpc_error_free_string(error_string); } switch (state) { + case GRPC_CHANNEL_INIT: case GRPC_CHANNEL_CONNECTING: case GRPC_CHANNEL_IDLE: case GRPC_CHANNEL_READY: diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c index fd6c52c4c1..cedf9170b7 100644 --- a/src/core/lib/transport/metadata.c +++ b/src/core/lib/transport/metadata.c @@ -441,8 +441,8 @@ void *grpc_mdelem_get_user_data(grpc_mdelem *md, void (*destroy_func)(void *)) { return result; } -void grpc_mdelem_set_user_data(grpc_mdelem *md, void (*destroy_func)(void *), - void *user_data) { +void *grpc_mdelem_set_user_data(grpc_mdelem *md, void (*destroy_func)(void *), + void *user_data) { internal_metadata *im = (internal_metadata *)md; GPR_ASSERT(!is_mdelem_static(md)); GPR_ASSERT((user_data == NULL) == (destroy_func == NULL)); @@ -453,9 +453,10 @@ void grpc_mdelem_set_user_data(grpc_mdelem *md, void (*destroy_func)(void *), if (destroy_func != NULL) { destroy_func(user_data); } - return; + return (void *)gpr_atm_no_barrier_load(&im->user_data); } gpr_atm_no_barrier_store(&im->user_data, (gpr_atm)user_data); gpr_atm_rel_store(&im->destroy_user_data, (gpr_atm)destroy_func); gpr_mu_unlock(&im->mu_user_data); + return user_data; } diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h index fcd1c9222f..50c8e1fa91 100644 --- a/src/core/lib/transport/metadata.h +++ b/src/core/lib/transport/metadata.h @@ -94,8 +94,8 @@ size_t grpc_mdelem_get_size_in_hpack_table(grpc_mdelem *elem); is used as a type tag and is checked during user_data fetch. */ void *grpc_mdelem_get_user_data(grpc_mdelem *md, void (*if_destroy_func)(void *)); -void grpc_mdelem_set_user_data(grpc_mdelem *md, void (*destroy_func)(void *), - void *user_data); +void *grpc_mdelem_set_user_data(grpc_mdelem *md, void (*destroy_func)(void *), + void *user_data); /* Reference counting */ //#define GRPC_METADATA_REFCOUNT_DEBUG diff --git a/src/core/lib/transport/metadata_batch.c b/src/core/lib/transport/metadata_batch.c index 4430224e70..b62ecc3aa6 100644 --- a/src/core/lib/transport/metadata_batch.c +++ b/src/core/lib/transport/metadata_batch.c @@ -143,7 +143,8 @@ void grpc_metadata_batch_move(grpc_metadata_batch *dst, void grpc_metadata_batch_filter(grpc_exec_ctx *exec_ctx, grpc_metadata_batch *batch, - grpc_mdelem *(*filter)(void *user_data, + grpc_mdelem *(*filter)(grpc_exec_ctx *exec_ctx, + void *user_data, grpc_mdelem *elem), void *user_data) { grpc_linked_mdelem *l; @@ -154,7 +155,7 @@ void grpc_metadata_batch_filter(grpc_exec_ctx *exec_ctx, assert_valid_list(&batch->list); for (l = batch->list.head; l; l = next) { grpc_mdelem *orig = l->md; - grpc_mdelem *filt = filter(user_data, orig); + grpc_mdelem *filt = filter(exec_ctx, user_data, orig); next = l->next; if (filt == NULL) { if (l->prev) { @@ -181,7 +182,8 @@ void grpc_metadata_batch_filter(grpc_exec_ctx *exec_ctx, GPR_TIMER_END("grpc_metadata_batch_filter", 0); } -static grpc_mdelem *no_metadata_for_you(void *user_data, grpc_mdelem *elem) { +static grpc_mdelem *no_metadata_for_you(grpc_exec_ctx *exec_ctx, + void *user_data, grpc_mdelem *elem) { return NULL; } diff --git a/src/core/lib/transport/metadata_batch.h b/src/core/lib/transport/metadata_batch.h index 862c21b45b..c0bd5174ab 100644 --- a/src/core/lib/transport/metadata_batch.h +++ b/src/core/lib/transport/metadata_batch.h @@ -122,7 +122,8 @@ void grpc_metadata_batch_add_tail(grpc_metadata_batch *batch, the element will be moved to the garbage list. */ void grpc_metadata_batch_filter(grpc_exec_ctx *exec_ctx, grpc_metadata_batch *batch, - grpc_mdelem *(*filter)(void *user_data, + grpc_mdelem *(*filter)(grpc_exec_ctx *exec_ctx, + void *user_data, grpc_mdelem *elem), void *user_data); diff --git a/src/core/lib/transport/pid_controller.h b/src/core/lib/transport/pid_controller.h index 059b5b0834..83c82d6471 100644 --- a/src/core/lib/transport/pid_controller.h +++ b/src/core/lib/transport/pid_controller.h @@ -61,4 +61,4 @@ void grpc_pid_controller_reset(grpc_pid_controller *pid_controller); double grpc_pid_controller_update(grpc_pid_controller *pid_controller, double error, double dt); -#endif +#endif /* GRPC_CORE_LIB_TRANSPORT_PID_CONTROLLER_H */ diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c index 1b79520e68..9bc278c133 100644 --- a/src/core/lib/transport/transport.c +++ b/src/core/lib/transport/transport.c @@ -161,6 +161,11 @@ char *grpc_transport_get_peer(grpc_exec_ctx *exec_ctx, return transport->vtable->get_peer(exec_ctx, transport); } +grpc_endpoint *grpc_transport_get_endpoint(grpc_exec_ctx *exec_ctx, + grpc_transport *transport) { + return transport->vtable->get_endpoint(exec_ctx, transport); +} + void grpc_transport_stream_op_finish_with_failure(grpc_exec_ctx *exec_ctx, grpc_transport_stream_op *op, grpc_error *error) { diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h index 3e38d98f28..d1281830aa 100644 --- a/src/core/lib/transport/transport.h +++ b/src/core/lib/transport/transport.h @@ -37,6 +37,7 @@ #include <stddef.h> #include "src/core/lib/channel/context.h" +#include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/polling_entity.h" #include "src/core/lib/iomgr/pollset.h" #include "src/core/lib/iomgr/pollset_set.h" @@ -296,6 +297,10 @@ void grpc_transport_destroy(grpc_exec_ctx *exec_ctx, grpc_transport *transport); char *grpc_transport_get_peer(grpc_exec_ctx *exec_ctx, grpc_transport *transport); +/* Get the endpoint used by \a transport */ +grpc_endpoint *grpc_transport_get_endpoint(grpc_exec_ctx *exec_ctx, + grpc_transport *transport); + /* Allocate a grpc_transport_op, and preconfigure the on_consumed closure to \a on_consumed and then delete the returned transport op */ grpc_transport_op *grpc_make_transport_op(grpc_closure *on_consumed); diff --git a/src/core/lib/transport/transport_impl.h b/src/core/lib/transport/transport_impl.h index fc7140671b..8553148c35 100644 --- a/src/core/lib/transport/transport_impl.h +++ b/src/core/lib/transport/transport_impl.h @@ -74,6 +74,9 @@ typedef struct grpc_transport_vtable { /* implementation of grpc_transport_get_peer */ char *(*get_peer)(grpc_exec_ctx *exec_ctx, grpc_transport *self); + + /* implementation of grpc_transport_get_endpoint */ + grpc_endpoint *(*get_endpoint)(grpc_exec_ctx *exec_ctx, grpc_transport *self); } grpc_transport_vtable; /* an instance of a grpc transport */ |