Permalink
Browse files

Previously calling pause in post_init did not stop receive_data from …

…begin called on the connection when epoll is enabled.

Fix this by only setting EPOLLIN in the new ConnectionDescriptor if SelectForRead is true.

If pause is called in post_init, SelectForRead will have become false during EventCallback.
  • Loading branch information...
1 parent e76ce6e commit 16c2719db29d582ea479862f901a456329daf56b @aaronriekenberg aaronriekenberg committed with tmm1 Nov 9, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 ext/ed.cpp
View
6 ext/ed.cpp
@@ -1447,14 +1447,16 @@ void AcceptorDescriptor::Read()
(*EventCallback) (GetBinding(), EM_CONNECTION_ACCEPTED, NULL, cd->GetBinding());
}
#ifdef HAVE_EPOLL
- cd->GetEpollEvent()->events = EPOLLIN | (cd->SelectForWrite() ? EPOLLOUT : 0);
+ cd->GetEpollEvent()->events =
+ (cd->SelectForRead() ? EPOLLIN : 0) | (cd->SelectForWrite() ? EPOLLOUT : 0);
#endif
assert (MyEventMachine);
MyEventMachine->Add (cd);
#ifdef HAVE_KQUEUE
if (cd->SelectForWrite())
MyEventMachine->ArmKqueueWriter (cd);
- MyEventMachine->ArmKqueueReader (cd);
+ if (cd->SelectForRead())
+ MyEventMachine->ArmKqueueReader (cd);
#endif
}

0 comments on commit 16c2719

Please sign in to comment.