summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-31 20:47:25 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-31 20:47:25 +0000
commitee034e0a5caa6a25deb426f211a0b5ece0a85edc (patch)
tree73a2ac4aa2049b9f9b30bf29ba2c4b1e697d27b8
parent986cae8a9d952562798dc8490949bf88f5af0db5 (diff)
Fix a whoopsy
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5611 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/socketengine_select.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/socketengine_select.cpp b/src/socketengine_select.cpp
index a26c28e51..abc1b953b 100644
--- a/src/socketengine_select.cpp
+++ b/src/socketengine_select.cpp
@@ -100,6 +100,8 @@ int SelectEngine::DispatchEvents()
timeval tval;
int sresult = 0;
EventHandler* ev[MAX_DESCRIPTORS];
+ socklen_t codesize;
+ int errcode;
FD_ZERO(&wfdset);
FD_ZERO(&rfdset);
@@ -139,10 +141,14 @@ int SelectEngine::DispatchEvents()
{
if (ev[i])
{
- if (FD_ISSET (a->second, &errfdset))
+ if (FD_ISSET (ev[i]->GetFd(), &errfdset))
{
if (ev[i])
- ev[i]->HandleEvent(EVENT_ERROR, 0);
+ {
+ if (getsockopt(ev[i]->GetFd(), SOL_SOCKET, SO_ERROR, &errcode, &codesize) < 0)
+ errcode = errno;
+ ev[i]->HandleEvent(EVENT_ERROR, errcode);
+ }
continue;
}
ServerInstance->Log(DEBUG,"Handle %s event on fd %d",writeable[ev[i]->GetFd()] || !ev[i]->Readable() ? "write" : "read", ev[i]->GetFd());