|
|
@ -76,6 +76,10 @@ static bool g_default_keepalive_permit_without_calls = |
|
|
|
grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER(false); |
|
|
|
grpc_tracer_flag grpc_http_trace = GRPC_TRACER_INITIALIZER(false); |
|
|
|
grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER(false); |
|
|
|
grpc_tracer_flag grpc_flowctl_trace = GRPC_TRACER_INITIALIZER(false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef NDEBUG |
|
|
|
|
|
|
|
grpc_tracer_flag grpc_trace_chttp2_refcount = GRPC_TRACER_INITIALIZER(false); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
static const grpc_transport_vtable vtable; |
|
|
|
static const grpc_transport_vtable vtable; |
|
|
|
|
|
|
|
|
|
|
|
/* forward declarations of various callbacks that we'll build closures around */ |
|
|
|
/* forward declarations of various callbacks that we'll build closures around */ |
|
|
@ -212,20 +216,26 @@ static void destruct_transport(grpc_exec_ctx *exec_ctx, |
|
|
|
gpr_free(t); |
|
|
|
gpr_free(t); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifdef GRPC_CHTTP2_REFCOUNTING_DEBUG |
|
|
|
#ifndef NDEBUG |
|
|
|
void grpc_chttp2_unref_transport(grpc_exec_ctx *exec_ctx, |
|
|
|
void grpc_chttp2_unref_transport(grpc_exec_ctx *exec_ctx, |
|
|
|
grpc_chttp2_transport *t, const char *reason, |
|
|
|
grpc_chttp2_transport *t, const char *reason, |
|
|
|
const char *file, int line) { |
|
|
|
const char *file, int line) { |
|
|
|
gpr_log(GPR_DEBUG, "chttp2:unref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", t, |
|
|
|
if (GRPC_TRACER_ON(grpc_trace_chttp2_refcount)) { |
|
|
|
t->refs.count, t->refs.count - 1, reason, file, line); |
|
|
|
gpr_atm val = gpr_atm_no_barrier_load(&t->refs.count); |
|
|
|
|
|
|
|
gpr_log(GPR_DEBUG, "chttp2:unref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", |
|
|
|
|
|
|
|
t, val, val - 1, reason, file, line); |
|
|
|
|
|
|
|
} |
|
|
|
if (!gpr_unref(&t->refs)) return; |
|
|
|
if (!gpr_unref(&t->refs)) return; |
|
|
|
destruct_transport(exec_ctx, t); |
|
|
|
destruct_transport(exec_ctx, t); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void grpc_chttp2_ref_transport(grpc_chttp2_transport *t, const char *reason, |
|
|
|
void grpc_chttp2_ref_transport(grpc_chttp2_transport *t, const char *reason, |
|
|
|
const char *file, int line) { |
|
|
|
const char *file, int line) { |
|
|
|
gpr_log(GPR_DEBUG, "chttp2: ref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", t, |
|
|
|
if (GRPC_TRACER_ON(grpc_trace_chttp2_refcount)) { |
|
|
|
t->refs.count, t->refs.count + 1, reason, file, line); |
|
|
|
gpr_atm val = gpr_atm_no_barrier_load(&t->refs.count); |
|
|
|
|
|
|
|
gpr_log(GPR_DEBUG, "chttp2: ref:%p %" PRIdPTR "->%" PRIdPTR " %s [%s:%d]", |
|
|
|
|
|
|
|
t, val, val + 1, reason, file, line); |
|
|
|
|
|
|
|
} |
|
|
|
gpr_ref(&t->refs); |
|
|
|
gpr_ref(&t->refs); |
|
|
|
} |
|
|
|
} |
|
|
|
#else |
|
|
|
#else |
|
|
|