aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2011-06-06 20:35:01 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2011-06-12 00:29:05 +0200
commit76d660ebd336d3dd47dd555ebbaa721a4cc978b2 (patch)
treece40033b63b17ee2527795781885a76310d5fe0d /src/net.h
parente051f1b510c2a8da51c099c73d5750b9c8c9422b (diff)
downloadbitcoin-76d660ebd336d3dd47dd555ebbaa721a4cc978b2.tar.xz
Faster timeout when connecting
Use non-blocking connects, and a select() call to wait a predefined time (5s by default, but configurable with -timeout) for either success or failure. This allows much more connections to be tried per time unit. Based on a patch by phantomcircuit.
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/net.h b/src/net.h
index d1ded87232..8a55856eed 100644
--- a/src/net.h
+++ b/src/net.h
@@ -19,6 +19,7 @@ class CRequestTracker;
class CNode;
class CBlockIndex;
extern int nBestHeight;
+extern int nConnectTimeout;
@@ -32,7 +33,7 @@ enum
-bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet);
+bool ConnectSocket(const CAddress& addrConnect, SOCKET& hSocketRet, int nTimeout=nConnectTimeout);
bool Lookup(const char *pszName, std::vector<CAddress>& vaddr, int nServices, int nMaxSolutions, bool fAllowLookup = false, int portDefault = 0, bool fAllowPort = false);
bool Lookup(const char *pszName, CAddress& addr, int nServices, bool fAllowLookup = false, int portDefault = 0, bool fAllowPort = false);
bool GetMyExternalIP(unsigned int& ipRet);