diff options
-rw-r--r-- | src/socketengine_kqueue.cpp | 8 | ||||
-rw-r--r-- | src/users.cpp | 7 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/socketengine_kqueue.cpp b/src/socketengine_kqueue.cpp index 59e4c4812..e0e6fe029 100644 --- a/src/socketengine_kqueue.cpp +++ b/src/socketengine_kqueue.cpp @@ -110,7 +110,7 @@ bool KQueueEngine::DelFd(EventHandler* eh) void KQueueEngine::WantWrite(EventHandler* eh) { struct kevent ke; - EV_SET(&ke, eh->GetFd(), EVFILT_WRITE | EVFILT_READ, EV_ADD | EV_ONESHOT, 0, 0, NULL); + EV_SET(&ke, eh->GetFd(), EVFILT_WRITE, EV_ADD | EV_ONESHOT, 0, 0, NULL); int i = kevent(EngineHandle, &ke, 1, 0, 0, NULL); if (i == -1) { @@ -150,8 +150,12 @@ int KQueueEngine::DispatchEvents() { ServerInstance->Log(DEBUG,"kqueue: Unable to set fd %d back to just wanting to read!", ke_list[j].ident); } + ref[ke_list[j].ident]->HandleEvent(EVENT_WRITE); + } + else + { + ref[ke_list[j].ident]->HandleEvent(EVENT_READ); } - ref[ke_list[j].ident]->HandleEvent(ke_list[j].flags & EVFILT_WRITE ? EVENT_WRITE : EVENT_READ); } return i; diff --git a/src/users.cpp b/src/users.cpp index 3c882f867..808d25a25 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -645,12 +645,16 @@ void userrec::FlushWriteBuf() if (n_sent == -1) { if (errno == EAGAIN) + { + ServerInstance->Log(DEBUG,"EAGAIN, want write"); this->ServerInstance->SE->WantWrite(this); + } else this->SetWriteError(strerror(errno)); } else { + /*ServerInstance->Log(DEBUG,"Wrote: %d of %d: %s", n_sent, old_sendq_length, sendq.substr(0, n_sent).c_str());*/ // advance the queue tb += n_sent; this->sendq = tb; @@ -658,7 +662,10 @@ void userrec::FlushWriteBuf() this->bytes_out += n_sent; this->cmds_out++; if (n_sent != old_sendq_length) + { + ServerInstance->Log(DEBUG,"Not all written, want write"); this->ServerInstance->SE->WantWrite(this); + } } } } |