From 4bb033449de57d7d2ac873bc70631b43ab7ce3d9 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 31 Oct 2006 20:30:16 +0000 Subject: Start of stuff to handle socket error state git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5606 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspsocket.cpp | 1 + src/socketengine_kqueue.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') 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); } } -- cgit v1.2.3