diff options
author | Yang Gao <yangg@google.com> | 2016-10-04 10:20:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-04 10:20:10 -0700 |
commit | 0bb3fdb5c0685ea65d6d7124ebbb8dab20d1e42e (patch) | |
tree | 317cf24a8430f12255b73d3de9af2c8cb8e75895 /src/core/lib | |
parent | 2fd004a5c55ed783acc27501c8e67cd2f0e4665c (diff) | |
parent | ce8f977593dc111e9c1516accbbb88913812090f (diff) |
Merge pull request #7596 from rjshade/orphan_before_shutdown
Call orphan_cb before FD shutdown in udp_server
Diffstat (limited to 'src/core/lib')
-rw-r--r-- | src/core/lib/iomgr/udp_server.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/udp_server.c b/src/core/lib/iomgr/udp_server.c index 48032412a2..12e929fa6a 100644 --- a/src/core/lib/iomgr/udp_server.c +++ b/src/core/lib/iomgr/udp_server.c @@ -171,6 +171,8 @@ static void deactivated_all_ports(grpc_exec_ctx *exec_ctx, grpc_udp_server *s) { sp->destroyed_closure.cb = destroyed_port; sp->destroyed_closure.cb_arg = s; + /* Call the orphan_cb to signal that the FD is about to be closed and + * should no longer be used. */ GPR_ASSERT(sp->orphan_cb); sp->orphan_cb(sp->emfd); @@ -197,6 +199,11 @@ void grpc_udp_server_destroy(grpc_exec_ctx *exec_ctx, grpc_udp_server *s, /* shutdown all fd's */ if (s->active_ports) { for (i = 0; i < s->nports; i++) { + /* Call the orphan_cb to signal that the FD is about to be closed and + * should no longer be used. */ + GPR_ASSERT(sp->orphan_cb); + sp->orphan_cb(sp->emfd); + grpc_fd_shutdown(exec_ctx, s->ports[i].emfd); } gpr_mu_unlock(&s->mu); |