From c0e82e2aa4b4ea15f5e3818ee8448f12af7af176 Mon Sep 17 00:00:00 2001 From: yedongfu Date: Mon, 16 Dec 2019 16:27:26 +0800 Subject: [PATCH] revert loop_once handle read/write in one loop --- handy/poller.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/handy/poller.cc b/handy/poller.cc index 196e59f..29346ae 100644 --- a/handy/poller.cc +++ b/handy/poller.cc @@ -92,15 +92,13 @@ void PollerEpoll::loop_once(int waitMs) { Channel *ch = (Channel *) activeEvs_[i].data.ptr; int events = activeEvs_[i].events; if (ch) { - if (events & kWriteEvent) { - trace("channel %lld fd %d handle write", (long long) ch->id(), ch->fd()); - ch->handleWrite(); - } if (events & (kReadEvent | POLLERR)) { trace("channel %lld fd %d handle read", (long long) ch->id(), ch->fd()); ch->handleRead(); - } - if (!(events & (kReadEvent | kWriteEvent | POLLERR))){ + } else if (events & kWriteEvent) { + trace("channel %lld fd %d handle write", (long long) ch->id(), ch->fd()); + ch->handleWrite(); + } else { fatal("unexpected poller events"); } }