Skip to content

Commit

Permalink
revert loop_once handle read/write in one loop
Browse files Browse the repository at this point in the history
  • Loading branch information
yedongfu committed Dec 16, 2019
1 parent 5fa9f91 commit c0e82e2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions handy/poller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
Expand Down

0 comments on commit c0e82e2

Please sign in to comment.