diff options
author | Guantao Liu <guantaol@google.com> | 2018-11-19 12:31:21 -0800 |
---|---|---|
committer | Guantao Liu <guantaol@google.com> | 2018-11-19 12:31:21 -0800 |
commit | be5eea1f42de9cc108d589361783b9996024ffd3 (patch) | |
tree | 6041be5a0064e42b1f43472860d4d9fa42862d6d /src/core/lib/iomgr/tcp_posix.cc | |
parent | 168965b2c21f0ebfc9a81bec4aaff87acf064326 (diff) |
Extend ev_posix.* to prepare for the new background poller 'epollbg',
and get rid of the dependency loop on the grpc shutdown path. Make sure
all background closures are complete before shutting down the other grpc
modules.
Avoid using the backup poller in TCP endpoints if using the background
poller.
Diffstat (limited to 'src/core/lib/iomgr/tcp_posix.cc')
-rw-r--r-- | src/core/lib/iomgr/tcp_posix.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index aa2704ce26..c802fcca75 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -260,10 +260,17 @@ static void notify_on_write(grpc_tcp* tcp) { if (grpc_tcp_trace.enabled()) { gpr_log(GPR_INFO, "TCP:%p notify_on_write", tcp); } - cover_self(tcp); - GRPC_CLOSURE_INIT(&tcp->write_done_closure, - tcp_drop_uncovered_then_handle_write, tcp, - grpc_schedule_on_exec_ctx); + if (grpc_event_engine_run_in_background()) { + // If there is a polling engine always running in the background, there is + // no need to run the backup poller. + GRPC_CLOSURE_INIT(&tcp->write_done_closure, tcp_handle_write, tcp, + grpc_schedule_on_exec_ctx); + } else { + cover_self(tcp); + GRPC_CLOSURE_INIT(&tcp->write_done_closure, + tcp_drop_uncovered_then_handle_write, tcp, + grpc_schedule_on_exec_ctx); + } grpc_fd_notify_on_write(tcp->em_fd, &tcp->write_done_closure); } |