From f5bc7aa7ceaee27df4aa047f3b702619f15fa00c Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 11 Dec 2006 18:23:15 +0000 Subject: Untested, new clever pointer voodoo class for binary-safe ziplinks output buffers PLUS: Fix for random epoll dispatchevents crashes. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5926 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/socketengine_select.cpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src/socketengine_select.cpp') diff --git a/src/socketengine_select.cpp b/src/socketengine_select.cpp index 19a2ec882..b7a9c3597 100644 --- a/src/socketengine_select.cpp +++ b/src/socketengine_select.cpp @@ -147,22 +147,26 @@ int SelectEngine::DispatchEvents() { if (getsockopt(ev[i]->GetFd(), SOL_SOCKET, SO_ERROR, &errcode, &codesize) < 0) errcode = errno; - ev[i]->HandleEvent(EVENT_ERROR, errcode); + + v[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()); - if (writeable[ev[i]->GetFd()]) + if (ev[i]) { - if (ev[i]) - ev[i]->HandleEvent(EVENT_WRITE); - writeable[ev[i]->GetFd()] = false; - - } - else - { - if (ev[i]) - ev[i]->HandleEvent(ev[i]->Readable() ? EVENT_READ : EVENT_WRITE); + ServerInstance->Log(DEBUG,"Handle %s event on fd %d",writeable[ev[i]->GetFd()] || !ev[i]->Readable() ? "write" : "read", ev[i]->GetFd()); + if (writeable[ev[i]->GetFd()]) + { + if (ev[i]) + ev[i]->HandleEvent(EVENT_WRITE); + writeable[ev[i]->GetFd()] = false; + + } + else + { + if (ev[i]) + ev[i]->HandleEvent(ev[i]->Readable() ? EVENT_READ : EVENT_WRITE); + } } } } -- cgit v1.2.3