From fdbd728a829569c50945908069fd8d9f8e6db3d6 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Aug 2015 15:24:26 -0700 Subject: [PATCH 1/2] Rename constants --- include/grpc/grpc.h | 13 +++++++------ src/core/surface/call.c | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 0b335a09247..003e1d7c9a4 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -358,8 +358,9 @@ typedef struct grpc_op { /** Propagate deadline */ #define GRPC_PROPAGATE_DEADLINE ((gpr_uint32)1) /** Propagate census context */ -#define GRPC_PROPAGATE_STATS_CONTEXT ((gpr_uint32)2) -#define GRPC_PROPAGATE_TRACING_CONTEXT ((gpr_uint32)4) +#define GRPC_PROPAGATE_CENSUS_STATS_CONTEXT ((gpr_uint32)2) +#define GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT ((gpr_uint32)4) +/** Propagate cancellation */ #define GRPC_PROPAGATE_CANCELLATION ((gpr_uint32)8) /* Default propagation mask: clients of the core API are encouraged to encode @@ -367,10 +368,10 @@ typedef struct grpc_op { GRPC_PROPAGATE_DEFAULTS & ~GRPC_PROPAGATE_DEADLINE to disable deadline propagation. Doing so gives flexibility in the future to define new propagation types that are default inherited or not. */ -#define GRPC_PROPAGATE_DEFAULTS \ - ((gpr_uint32)((0xffff | GRPC_PROPAGATE_DEADLINE | \ - GRPC_PROPAGATE_STATS_CONTEXT | \ - GRPC_PROPAGATE_TRACING_CONTEXT))) +#define GRPC_PROPAGATE_DEFAULTS \ + ((gpr_uint32)((0xffff | GRPC_PROPAGATE_DEADLINE | \ + GRPC_PROPAGATE_CENSUS_STATS_CONTEXT | \ + GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT))) /** Initialize the grpc library. diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 22a17f892e8..7ba1d54a15d 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -374,13 +374,13 @@ grpc_call *grpc_call_create(grpc_channel *channel, grpc_call *parent_call, } /* for now GRPC_PROPAGATE_TRACING_CONTEXT *MUST* be passed with * GRPC_PROPAGATE_STATS_CONTEXT */ - if (propagation_mask & GRPC_PROPAGATE_TRACING_CONTEXT) { - GPR_ASSERT(propagation_mask & GRPC_PROPAGATE_STATS_CONTEXT); + if (propagation_mask & GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT) { + GPR_ASSERT(propagation_mask & GRPC_PROPAGATE_CENSUS_STATS_CONTEXT); grpc_call_context_set(call, GRPC_CONTEXT_TRACING, parent_call->context[GRPC_CONTEXT_TRACING].value, NULL); } else { - GPR_ASSERT(propagation_mask & GRPC_PROPAGATE_STATS_CONTEXT); + GPR_ASSERT(propagation_mask & GRPC_PROPAGATE_CENSUS_STATS_CONTEXT); } if (propagation_mask & GRPC_PROPAGATE_CANCELLATION) { call->cancellation_is_inherited = 1; From a6f8f925998768ebee8a86e0749bdbc443e5ea2e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 5 Aug 2015 15:25:45 -0700 Subject: [PATCH 2/2] Add comment --- src/core/surface/call.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 7ba1d54a15d..d3e66e9c4cc 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -374,6 +374,8 @@ grpc_call *grpc_call_create(grpc_channel *channel, grpc_call *parent_call, } /* for now GRPC_PROPAGATE_TRACING_CONTEXT *MUST* be passed with * GRPC_PROPAGATE_STATS_CONTEXT */ + /* TODO(ctiller): This should change to use the appropriate census start_op + * call. */ if (propagation_mask & GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT) { GPR_ASSERT(propagation_mask & GRPC_PROPAGATE_CENSUS_STATS_CONTEXT); grpc_call_context_set(call, GRPC_CONTEXT_TRACING,