diff options
author | Michael Lumish <mlumish@google.com> | 2017-02-27 10:50:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-27 10:50:31 -0800 |
commit | 07e4c13a68d8bb54463eb693afd16e29aec22e28 (patch) | |
tree | 737d0baf356d705931b5bef2d7953066a903e8f8 /src/core | |
parent | ca8de5c1c3aa47bff5ab83482ed4b33c8cbc3047 (diff) | |
parent | 98cdf3b3e61c2e5db5b7b945e471f2c898faab33 (diff) |
Merge pull request #9857 from murgatroid99/merge_1.1.x_master
Upmerge 1.1.x into master
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/lib/iomgr/tcp_uv.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c index 5fb398c50b..5541c62068 100644 --- a/src/core/lib/iomgr/tcp_uv.c +++ b/src/core/lib/iomgr/tcp_uv.c @@ -79,8 +79,6 @@ typedef struct { grpc_pollset *pollset; } grpc_tcp; -static void uv_close_callback(uv_handle_t *handle) { gpr_free(handle); } - static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { grpc_resource_user_unref(exec_ctx, tcp->resource_user); gpr_free(tcp); @@ -119,6 +117,13 @@ static void tcp_unref(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) { static void tcp_ref(grpc_tcp *tcp) { gpr_ref(&tcp->refcount); } #endif +static void uv_close_callback(uv_handle_t *handle) { + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_tcp *tcp = handle->data; + TCP_UNREF(&exec_ctx, tcp, "destroy"); + grpc_exec_ctx_finish(&exec_ctx); +} + static void alloc_uv_buf(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -313,7 +318,6 @@ static void uv_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) { grpc_network_status_unregister_endpoint(ep); grpc_tcp *tcp = (grpc_tcp *)ep; uv_close((uv_handle_t *)tcp->handle, uv_close_callback); - TCP_UNREF(exec_ctx, tcp, "destroy"); } static char *uv_get_peer(grpc_endpoint *ep) { |