summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/listensocket.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/listensocket.cpp b/src/listensocket.cpp
index 07ff2886e..d6fe2bb1f 100644
--- a/src/listensocket.cpp
+++ b/src/listensocket.cpp
@@ -100,6 +100,24 @@ void ListenSocket::AcceptInternal()
ServerInstance->stats->statsRefused++;
return;
}
+ /*
+ * XXX -
+ * this is done as a safety check to keep the file descriptors within range of fd_ref_table.
+ * its a pretty big but for the moment valid assumption:
+ * file descriptors are handed out starting at 0, and are recycled as theyre freed.
+ * therefore if there is ever an fd over 65535, 65536 clients must be connected to the
+ * irc server at once (or the irc server otherwise initiating this many connections, files etc)
+ * which for the time being is a physical impossibility (even the largest networks dont have more
+ * than about 10,000 users on ONE server!)
+ */
+ if (incomingSockfd >= ServerInstance->SE->GetMaxFds())
+ {
+ ServerInstance->Logs->Log("SOCKET", DEBUG, "Server is full");
+ ServerInstance->SE->Shutdown(incomingSockfd, 2);
+ ServerInstance->SE->Close(incomingSockfd);
+ ServerInstance->stats->statsRefused++;
+ return;
+ }
static char buf[MAXBUF];
static char target[MAXBUF];
@@ -127,25 +145,6 @@ void ListenSocket::AcceptInternal()
ServerInstance->Logs->Log("SOCKET", DEBUG, "Can't get peername: %s", strerror(errno));
}
- /*
- * XXX -
- * this is done as a safety check to keep the file descriptors within range of fd_ref_table.
- * its a pretty big but for the moment valid assumption:
- * file descriptors are handed out starting at 0, and are recycled as theyre freed.
- * therefore if there is ever an fd over 65535, 65536 clients must be connected to the
- * irc server at once (or the irc server otherwise initiating this many connections, files etc)
- * which for the time being is a physical impossibility (even the largest networks dont have more
- * than about 10,000 users on ONE server!)
- */
- if (incomingSockfd >= ServerInstance->SE->GetMaxFds())
- {
- ServerInstance->Logs->Log("SOCKET", DEBUG, "Server is full");
- ServerInstance->SE->Shutdown(incomingSockfd, 2);
- ServerInstance->SE->Close(incomingSockfd);
- ServerInstance->stats->statsRefused++;
- return;
- }
-
ServerInstance->SE->NonBlocking(incomingSockfd);
ServerInstance->stats->statsAccept++;
this->OnAcceptReady(target, incomingSockfd, buf);