summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/socketengine_epoll.cpp3
-rw-r--r--src/socketengine_iocp.cpp8
-rw-r--r--src/socketengine_kqueue.cpp5
-rw-r--r--src/socketengine_select.cpp1
4 files changed, 9 insertions, 8 deletions
diff --git a/src/socketengine_epoll.cpp b/src/socketengine_epoll.cpp
index 381701093..97efec127 100644
--- a/src/socketengine_epoll.cpp
+++ b/src/socketengine_epoll.cpp
@@ -48,7 +48,6 @@ bool EPollEngine::AddFd(EventHandler* eh)
if (ref[fd])
return false;
- ref[fd] = eh;
struct epoll_event ev;
memset(&ev,0,sizeof(struct epoll_event));
eh->Readable() ? ev.events = EPOLLIN : ev.events = EPOLLOUT;
@@ -60,6 +59,8 @@ bool EPollEngine::AddFd(EventHandler* eh)
}
ServerInstance->Log(DEBUG,"New file descriptor: %d", fd);
+
+ ref[fd] = eh;
CurrentSetSize++;
return true;
}
diff --git a/src/socketengine_iocp.cpp b/src/socketengine_iocp.cpp
index d66ca2ac4..96ff9eb31 100644
--- a/src/socketengine_iocp.cpp
+++ b/src/socketengine_iocp.cpp
@@ -74,10 +74,6 @@ bool IOCPEngine::AddFd(EventHandler* eh)
if (!CreateIoCompletionPort((HANDLE)eh->GetFd(), m_completionPort, completion_key, 0))
return false;
- /* set up binding, increase set size */
- ref[*fake_fd] = eh;
- ++CurrentSetSize;
-
/* setup initial events */
if(is_accept)
PostAcceptEvent(eh);
@@ -101,6 +97,10 @@ bool IOCPEngine::AddFd(EventHandler* eh)
/* Ohshi-, map::insert failed :/ */
return false;
}
+
+ ++CurrentSetSize;
+ ref[*fake_fd] = eh;
+
return true;
}
diff --git a/src/socketengine_kqueue.cpp b/src/socketengine_kqueue.cpp
index e33f9f772..50f6242e2 100644
--- a/src/socketengine_kqueue.cpp
+++ b/src/socketengine_kqueue.cpp
@@ -61,15 +61,16 @@ bool KQueueEngine::AddFd(EventHandler* eh)
if (ref[fd])
return false;
- ref[fd] = eh;
-
struct kevent ke;
EV_SET(&ke, fd, eh->Readable() ? EVFILT_READ : EVFILT_WRITE, EV_ADD, 0, 0, NULL);
int i = kevent(EngineHandle, &ke, 1, 0, 0, NULL);
if (i == -1)
+ {
return false;
+ }
+ ref[fd] = eh;
CurrentSetSize++;
ServerInstance->Log(DEBUG,"New file descriptor: %d", fd);
diff --git a/src/socketengine_select.cpp b/src/socketengine_select.cpp
index b87d2769d..c70e609b5 100644
--- a/src/socketengine_select.cpp
+++ b/src/socketengine_select.cpp
@@ -42,7 +42,6 @@ bool SelectEngine::AddFd(EventHandler* eh)
return false;
ref[fd] = eh;
-
CurrentSetSize++;
ServerInstance->Log(DEBUG,"New file descriptor: %d", fd);