From ba29a5590bc4479d74454f0b9fdaf007d9d80221 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 26 Apr 2013 00:46:47 +0200 Subject: Try to increase file descriptor rlimit if necessary As the default can be too low, especially on OSX. --- src/net.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/net.cpp') diff --git a/src/net.cpp b/src/net.cpp index 031126180d..3fa48ae484 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -48,6 +48,7 @@ static CNode* pnodeSync = NULL; uint64 nLocalHostNonce = 0; static std::vector vhListenSocket; CAddrMan addrman; +int nMaxConnections = 125; vector vNodes; CCriticalSection cs_vNodes; @@ -908,7 +909,7 @@ void ThreadSocketHandler() if (nErr != WSAEWOULDBLOCK) printf("socket error accept failed: %d\n", nErr); } - else if (nInbound >= GetArg("-maxconnections", 125) - MAX_OUTBOUND_CONNECTIONS) + else if (nInbound >= nMaxConnections - MAX_OUTBOUND_CONNECTIONS) { { LOCK(cs_setservAddNodeAddresses); @@ -1803,7 +1804,7 @@ void StartNode(boost::thread_group& threadGroup) { if (semOutbound == NULL) { // initialize semaphore - int nMaxOutbound = min(MAX_OUTBOUND_CONNECTIONS, (int)GetArg("-maxconnections", 125)); + int nMaxOutbound = min(MAX_OUTBOUND_CONNECTIONS, nMaxConnections); semOutbound = new CSemaphore(nMaxOutbound); } -- cgit v1.2.3