aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr/tcp_posix.cc
diff options
context:
space:
mode:
authorGravatar Guantao Liu <guantaol@users.noreply.github.com>2018-11-28 15:37:28 -0800
committerGravatar GitHub <noreply@github.com>2018-11-28 15:37:28 -0800
commit99673fcbe341a981c27d2becd572468863bff33b (patch)
treec54f9cfe836db2144e1dcbfd32bef322aee9356c /src/core/lib/iomgr/tcp_posix.cc
parent1b9df7d183f3a4f7d2bf02bb1ed8fae8ebe70c86 (diff)
parentdc9ffa80349498cd80fd316b66571f6e94c2eaa1 (diff)
Merge pull request #17244 from guantaol/ev_epollbg
Preparation for the new background poller 'epollbg'
Diffstat (limited to 'src/core/lib/iomgr/tcp_posix.cc')
-rw-r--r--src/core/lib/iomgr/tcp_posix.cc15
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 4a5ca615e5..606bfce6e7 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);
}