From a8b011fd501df11509b8b5c7d0dfdcf35b7e0298 Mon Sep 17 00:00:00 2001 From: psychon Date: Tue, 8 Jun 2010 19:09:47 +0000 Subject: [PATCH] GetAnonConnectionCount(): Bugfix The function counted almost all sockets, but it's only supposed to count inbound ones which aren't identified client sockets. Do this by adding a check for "socket is really inbound" in there. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2019 726aef4b-f618-498e-8847-2d620e286838 --- Socket.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Socket.cpp b/Socket.cpp index 42742715..db8e3ec0 100644 --- a/Socket.cpp +++ b/Socket.cpp @@ -18,7 +18,8 @@ unsigned int CSockManager::GetAnonConnectionCount(const CString &sIP) const { for (it = begin(); it != end(); ++it) { CZNCSock *pSock = *it; // Logged in CClients have "USR::" as their sockname - if (pSock->GetRemoteIP() == sIP && pSock->GetSockName().Left(5) != "USR::") { + if (pSock->GetType() == Csock::INBOUND && pSock->GetRemoteIP() == sIP + && pSock->GetSockName().Left(5) != "USR::") { ret++; } }