summaryrefslogtreecommitdiff
path: root/src/socket.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-08 09:32:57 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-08 09:32:57 +0000
commit2329d59b09cdc05b0b403f7d313df65492e1813b (patch)
tree6d5f005565b62883e09ed2b2e09752fc034da413 /src/socket.cpp
parent3794888ebf1fb19f404c22ff2d5333ccc6c3129e (diff)
Extra checking that the fd's we pass to SocketEngine::AddFd were added (a lot of assuming was going off, leading to total chaos if we run out of fd's etc)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4780 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/socket.cpp')
-rw-r--r--src/socket.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index 04a4f5f15..1916bb555 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -359,8 +359,14 @@ int BindPorts(bool bail)
/* Associate the new open port with a slot in the socket engine */
if (Config->openSockfd[count] > -1)
{
- ServerInstance->SE->AddFd(Config->openSockfd[count],true,X_LISTEN);
- BoundPortCount++;
+ if (!ServerInstance->SE->AddFd(Config->openSockfd[count],true,X_LISTEN))
+ {
+ log(DEFAULT,"ERK! Failed to add listening port to socket engine!");
+ shutdown(Config->openSockfd[count],2);
+ close(Config->openSockfd[count]);
+ }
+ else
+ BoundPortCount++;
}
}
}