Skip to content

Commit

Permalink
remove ET for accept
Browse files Browse the repository at this point in the history
  • Loading branch information
yedf committed May 11, 2016
1 parent a2a2ea2 commit 3668496
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions raw-examples/epoll-et.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void setNonBlock(int fd) {
void updateEvents(int efd, int fd, int events, int op) {
struct epoll_event ev;
memset(&ev, 0, sizeof(ev));
ev.events = events | EPOLLET;
ev.events = events;
ev.data.fd = fd;
printf("%s fd %d events read %d write %d\n",
op==EPOLL_CTL_MOD?"mod":"add", fd, ev.events & EPOLLIN, ev.events & EPOLLOUT);
Expand All @@ -53,7 +53,7 @@ void handleAccept(int efd, int fd) {
exit_if(r<0, "getpeername failed");
printf("accept a connection from %s\n", inet_ntoa(raddr.sin_addr));
setNonBlock(cfd);
updateEvents(efd, cfd, EPOLLIN|EPOLLOUT, EPOLL_CTL_ADD);
updateEvents(efd, cfd, EPOLLIN|EPOLLOUT|EPOLLET, EPOLL_CTL_ADD);
}
struct Con {
string readed;
Expand Down

0 comments on commit 3668496

Please sign in to comment.