diff --git a/src/core/iomgr/fd_posix.c b/src/core/iomgr/fd_posix.c index 4cbc46cd179..3ff27631be0 100644 --- a/src/core/iomgr/fd_posix.c +++ b/src/core/iomgr/fd_posix.c @@ -347,16 +347,19 @@ void grpc_fd_end_poll(grpc_fd_watcher *watcher, int got_read, int got_write) { gpr_mu_lock(&fd->watcher_mu); if (watcher == fd->read_watcher) { + /* remove read watcher, kick if we still need a read */ was_polling = 1; kick |= !got_read; fd->read_watcher = NULL; } if (watcher == fd->write_watcher) { + /* remove write watcher, kick if we still need a write */ was_polling = 1; kick |= !got_write; fd->write_watcher = NULL; } if (!was_polling) { + /* remove from inactive list */ watcher->next->prev = watcher->prev; watcher->prev->next = watcher->next; }