summaryrefslogtreecommitdiff
path: root/chat/licq-core/patches/patch-ac
diff options
context:
space:
mode:
Diffstat (limited to 'chat/licq-core/patches/patch-ac')
-rw-r--r--chat/licq-core/patches/patch-ac36
1 files changed, 36 insertions, 0 deletions
diff --git a/chat/licq-core/patches/patch-ac b/chat/licq-core/patches/patch-ac
new file mode 100644
index 00000000000..fa863cf0901
--- /dev/null
+++ b/chat/licq-core/patches/patch-ac
@@ -0,0 +1,36 @@
+$NetBSD: patch-ac,v 1.5 2008/05/11 04:12:34 tonnerre Exp $
+
+--- src/icqd-threads.cpp.orig 2007-09-28 22:11:35.000000000 +0200
++++ src/icqd-threads.cpp
+@@ -23,6 +23,7 @@
+ // Localization
+ #include "gettext.h"
+
++#define MAX_CONNECTS 256
+ #define DEBUG_THREADS(x)
+ //#define DEBUG_THREADS(x) gLog.Info(x)
+
+@@ -780,8 +781,21 @@ void *MonitorSockets_tep(void *p)
+ TCPSocket *newSocket = new TCPSocket(0);
+ tcp->RecvConnection(*newSocket);
+ gSocketManager.DropSocket(tcp);
+- gSocketManager.AddSocket(newSocket);
+- gSocketManager.DropSocket(newSocket);
++
++ // Make sure we can handle another socket before accepting it
++ if (gSocketManager.Num() > MAX_CONNECTS)
++ {
++ // Too many sockets, drop this one
++ char remoteIp[32];
++ gLog.Warn(tr("%sToo many connected sockets, rejecting connection from %s.\n"),
++ L_WARNxSTR, newSocket->RemoteIpStr(remoteIp));
++ delete newSocket;
++ }
++ else
++ {
++ gSocketManager.AddSocket(newSocket);
++ gSocketManager.DropSocket(newSocket);
++ }
+ }
+ }
+