|
|
|
@ -88,12 +88,12 @@ static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { |
|
|
|
|
#ifdef GRPC_TCP_REFCOUNT_DEBUG |
|
|
|
|
#define TCP_UNREF(exec_ctx, tcp, reason) \ |
|
|
|
|
tcp_unref((exec_ctx), (tcp), (reason), __FILE__, __LINE__) |
|
|
|
|
#define TCP_REF(tcp, reason) \ |
|
|
|
|
tcp_ref((exec_ctx), (tcp), (reason), __FILE__, __LINE__) |
|
|
|
|
#define TCP_REF(tcp, reason) tcp_ref((tcp), (reason), __FILE__, __LINE__) |
|
|
|
|
static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, |
|
|
|
|
const char *reason, const char *file, int line) { |
|
|
|
|
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP unref %p : %s %d -> %d", tcp, |
|
|
|
|
reason, tcp->refcount.count, tcp->refcount.count - 1); |
|
|
|
|
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, |
|
|
|
|
"TCP unref %p : %s %" PRIiPTR " -> %" PRIiPTR, tcp, reason, |
|
|
|
|
tcp->refcount.count, tcp->refcount.count - 1); |
|
|
|
|
if (gpr_unref(&tcp->refcount)) { |
|
|
|
|
tcp_free(exec_ctx, tcp); |
|
|
|
|
} |
|
|
|
@ -101,8 +101,9 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp, |
|
|
|
|
|
|
|
|
|
static void tcp_ref(grpc_tcp *tcp, const char *reason, const char *file, |
|
|
|
|
int line) { |
|
|
|
|
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, "TCP ref %p : %s %d -> %d", tcp, |
|
|
|
|
reason, tcp->refcount.count, tcp->refcount.count + 1); |
|
|
|
|
gpr_log(file, line, GPR_LOG_SEVERITY_DEBUG, |
|
|
|
|
"TCP ref %p : %s %" PRIiPTR " -> %" PRIiPTR, tcp, reason, |
|
|
|
|
tcp->refcount.count, tcp->refcount.count + 1); |
|
|
|
|
gpr_ref(&tcp->refcount); |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
@ -311,6 +312,7 @@ static void uv_endpoint_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, |
|
|
|
|
tcp->shutting_down = true; |
|
|
|
|
uv_shutdown_t *req = &tcp->shutdown_req; |
|
|
|
|
uv_shutdown(req, (uv_stream_t *)tcp->handle, shutdown_callback); |
|
|
|
|
grpc_resource_user_shutdown(exec_ctx, tcp->resource_user); |
|
|
|
|
} |
|
|
|
|
GRPC_ERROR_UNREF(why); |
|
|
|
|
} |
|
|
|
|