summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-31 20:30:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-31 20:30:16 +0000
commit4bb033449de57d7d2ac873bc70631b43ab7ce3d9 (patch)
treebdf71dd9629f7b6e57f90f7fb4add6a49741c1d7
parentf4a1bfe7c060f633de970287ff5e49dcc57f5a9a (diff)
Start of stuff to handle socket error state
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5606 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/inspsocket.cpp1
-rw-r--r--src/socketengine_kqueue.cpp13
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);
}
}