From ff74d9212add9085a32f5a6251ef3e1e74e603ad Mon Sep 17 00:00:00 2001 From: yang-g Date: Tue, 15 May 2018 14:13:35 -0700 Subject: [PATCH] Round robin incoming connection on a per-fd basis --- src/core/lib/iomgr/tcp_server_posix.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/lib/iomgr/tcp_server_posix.cc b/src/core/lib/iomgr/tcp_server_posix.cc index 153ac634248..484d2b60777 100644 --- a/src/core/lib/iomgr/tcp_server_posix.cc +++ b/src/core/lib/iomgr/tcp_server_posix.cc @@ -187,11 +187,6 @@ static void on_read(void* arg, grpc_error* err) { goto error; } - read_notifier_pollset = - sp->server->pollsets[static_cast(gpr_atm_no_barrier_fetch_add( - &sp->server->next_pollset_to_assign, 1)) % - sp->server->pollset_count]; - /* loop until accept4 returns EAGAIN, and then re-arm notification */ for (;;) { grpc_resolved_address addr; @@ -233,6 +228,11 @@ static void on_read(void* arg, grpc_error* err) { grpc_fd* fdobj = grpc_fd_create(fd, name); + read_notifier_pollset = + sp->server->pollsets[static_cast(gpr_atm_no_barrier_fetch_add( + &sp->server->next_pollset_to_assign, 1)) % + sp->server->pollset_count]; + grpc_pollset_add_fd(read_notifier_pollset, fdobj); // Create acceptor.