Ticket #1623: licq-6140-connectionlimit.patch
| File licq-6140-connectionlimit.patch, 1.5 kB (added by flynd, 9 months ago) |
|---|
-
include/licq_socket.h
250 250 251 251 fd_set SocketSet() { return m_sSockets.SocketSet(); } 252 252 int LargestSocket() { return m_sSockets.Largest(); } 253 unsigned short Num() { return m_sSockets.Num(); } 253 254 254 255 protected: 255 256 CSocketSet m_sSockets; -
src/icqd-threads.cpp
780 780 TCPSocket *newSocket = new TCPSocket(0); 781 781 tcp->RecvConnection(*newSocket); 782 782 gSocketManager.DropSocket(tcp); 783 gSocketManager.AddSocket(newSocket); 784 gSocketManager.DropSocket(newSocket); 783 784 // Make sure we can handle another socket before accepting it 785 if (newSocket->Descriptor() >= FD_SETSIZE || gSocketManager.Num() > 128) 786 { 787 // Too many sockets, drop this one 788 char remoteIp[32]; 789 gLog.Warn(tr("%sToo many connected sockets, rejecting connection from %s.\n"), 790 L_WARNxSTR, newSocket->RemoteIpStr(remoteIp)); 791 delete newSocket; 792 } 793 else 794 { 795 gSocketManager.AddSocket(newSocket); 796 gSocketManager.DropSocket(newSocket); 797 } 785 798 } 786 799 } 787 800
