diff options
-rw-r--r-- | src/inspsocket.cpp | 1 | ||||
-rw-r--r-- | src/socketengine_kqueue.cpp | 13 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 982c56750..9b691fc7f 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -513,6 +513,7 @@ void InspSocket::HandleEvent(EventType et) } else { + Instance->Log(DEBUG,"State=%d CONNECTED=%d", this->state, I_CONNECTED); if (this->FlushWriteBuffer()) { this->Instance->SE->DelFd(this); diff --git a/src/socketengine_kqueue.cpp b/src/socketengine_kqueue.cpp index 9a63c972f..4abde652d 100644 --- a/src/socketengine_kqueue.cpp +++ b/src/socketengine_kqueue.cpp @@ -142,6 +142,13 @@ int KQueueEngine::DispatchEvents() for (int j = 0; j < i; j++) { ServerInstance->Log(DEBUG,"Handle %s event on fd %d",ke_list[j].flags & EVFILT_WRITE ? "write" : "read", ke_list[j].ident); + if (ke_list[j].flags & EV_EOF) + { + ServerInstance->Log(DEBUG,"kqueue: Error on FD %d", ke_list[j].ident); + /* Sneaky tricksy hobitses! */ + ref[ke_list[j].ident]->HandleEvent(EVENT_ERROR, ke_list[j].fflags); + continue; + } if (ke_list[j].flags & EVFILT_WRITE) { struct kevent ke; @@ -151,11 +158,13 @@ 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); + if (ref[ke_list[j].ident]) + ref[ke_list[j].ident]->HandleEvent(EVENT_WRITE); } else { - ref[ke_list[j].ident]->HandleEvent(EVENT_READ); + if (ref[ke_list[j].ident]) + ref[ke_list[j].ident]->HandleEvent(EVENT_READ); } } |