summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-21 19:24:09 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-21 19:24:09 +0000
commit0c04ea89dbb1516423535b2f5fdadbdab9fe8e58 (patch)
tree7d599b208f24869822cc1c619a3de755852e0e34 /src
parent32bffd861fd1c8b723ae63f4ea66720fd47e7d0a (diff)
Set these back to sane operation
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8271 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/socketengine_epoll.cpp8
-rw-r--r--src/socketengine_iocp.cpp8
-rw-r--r--src/socketengine_kqueue.cpp8
-rw-r--r--src/socketengine_ports.cpp2
-rw-r--r--src/socketengine_select.cpp3
5 files changed, 18 insertions, 11 deletions
diff --git a/src/socketengine_epoll.cpp b/src/socketengine_epoll.cpp
index df79aa083..ec5362f8c 100644
--- a/src/socketengine_epoll.cpp
+++ b/src/socketengine_epoll.cpp
@@ -49,7 +49,7 @@ bool EPollEngine::AddFd(EventHandler* eh)
return false;
if (ref[fd])
- DelFd(ref[fd]);
+ return false;
struct epoll_event ev;
memset(&ev,0,sizeof(struct epoll_event));
@@ -86,9 +86,6 @@ bool EPollEngine::DelFd(EventHandler* eh, bool force)
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
return false;
- ref[fd] = NULL;
- CurrentSetSize--;
-
struct epoll_event ev;
memset(&ev,0,sizeof(struct epoll_event));
eh->Readable() ? ev.events = EPOLLIN : ev.events = EPOLLOUT;
@@ -101,6 +98,9 @@ bool EPollEngine::DelFd(EventHandler* eh, bool force)
return false;
}
+ ref[fd] = NULL;
+ CurrentSetSize--;
+
ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd);
return true;
}
diff --git a/src/socketengine_iocp.cpp b/src/socketengine_iocp.cpp
index d780b9043..66ae7f8ba 100644
--- a/src/socketengine_iocp.cpp
+++ b/src/socketengine_iocp.cpp
@@ -54,11 +54,17 @@ bool IOCPEngine::AddFd(EventHandler* eh)
/* In range? */
if ((*fake_fd < 0) || (*fake_fd > MAX_DESCRIPTORS))
+ {
+ delete fake_fd;
return false;
+ }
/* Already an entry here */
if (ref[*fake_fd])
- DelFd(ref[fd]);
+ {
+ delete fake_fd;
+ return false;
+ }
/* are we a listen socket? */
getsockopt(eh->GetFd(), SOL_SOCKET, SO_ACCEPTCONN, (char*)&is_accept, &opt_len);
diff --git a/src/socketengine_kqueue.cpp b/src/socketengine_kqueue.cpp
index 0f6f805ca..50f6242e2 100644
--- a/src/socketengine_kqueue.cpp
+++ b/src/socketengine_kqueue.cpp
@@ -59,7 +59,7 @@ bool KQueueEngine::AddFd(EventHandler* eh)
return false;
if (ref[fd])
- DelFd(ref[fd]);
+ return false;
struct kevent ke;
EV_SET(&ke, fd, eh->Readable() ? EVFILT_READ : EVFILT_WRITE, EV_ADD, 0, 0, NULL);
@@ -93,12 +93,12 @@ bool KQueueEngine::DelFd(EventHandler* eh, bool force)
int j = kevent(EngineHandle, &ke, 1, 0, 0, NULL);
- CurrentSetSize--;
- ref[fd] = NULL;
-
if ((j < 0) && (i < 0) && !force)
return false;
+ CurrentSetSize--;
+ ref[fd] = NULL;
+
ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd);
return true;
}
diff --git a/src/socketengine_ports.cpp b/src/socketengine_ports.cpp
index 7ebceacc8..352b73062 100644
--- a/src/socketengine_ports.cpp
+++ b/src/socketengine_ports.cpp
@@ -46,7 +46,7 @@ bool PortsEngine::AddFd(EventHandler* eh)
return false;
if (ref[fd])
- DelFd(ref[fd]);
+ return false;
ref[fd] = eh;
port_associate(EngineHandle, PORT_SOURCE_FD, fd, eh->Readable() ? POLLRDNORM : POLLWRNORM, eh);
diff --git a/src/socketengine_select.cpp b/src/socketengine_select.cpp
index a369cc95a..7ba386812 100644
--- a/src/socketengine_select.cpp
+++ b/src/socketengine_select.cpp
@@ -37,7 +37,7 @@ bool SelectEngine::AddFd(EventHandler* eh)
return false;
if (ref[fd])
- DelFd(ref[fd]);
+ return false;
fds[fd] = fd;
ref[fd] = eh;
@@ -65,6 +65,7 @@ bool SelectEngine::DelFd(EventHandler* eh, bool force)
CurrentSetSize--;
ref[fd] = NULL;
+ fds[fd] = 0;
ServerInstance->Log(DEBUG,"Remove file descriptor: %d", fd);
return true;