aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-10-08 09:16:03 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-10-08 09:16:19 +0200
commit6860a55ea0c07eff56882efa7499bed35b173397 (patch)
tree8adbe700d952c8d842dcaa6f313ed8cd05364842
parentad9cd64d3b0dd4528b37f939bcb2c9205b44db65 (diff)
parentde10efd154d6c02fe8549a2dc9649a96cf601fd2 (diff)
Merge pull request #4979
de10efd add -timeout default as constant and use them (Philip Kaufmann)
-rw-r--r--src/init.cpp11
-rw-r--r--src/netbase.cpp2
-rw-r--r--src/netbase.h3
3 files changed, 8 insertions, 8 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 36ba13b941..97d0f58527 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -260,7 +260,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += " -port=<port> " + _("Listen for connections on <port> (default: 8333 or testnet: 18333)") + "\n";
strUsage += " -proxy=<ip:port> " + _("Connect through SOCKS5 proxy") + "\n";
strUsage += " -seednode=<ip> " + _("Connect to a node to retrieve peer addresses, and disconnect") + "\n";
- strUsage += " -timeout=<n> " + _("Specify connection timeout in milliseconds (default: 5000)") + "\n";
+ strUsage += " -timeout=<n> " + strprintf(_("Specify connection timeout in milliseconds (minimum: 1, default: %d)"), DEFAULT_CONNECT_TIMEOUT) + "\n";
#ifdef USE_UPNP
#if USE_UPNP
strUsage += " -upnp " + _("Use UPnP to map the listening port (default: 1 when listening)") + "\n";
@@ -640,12 +640,9 @@ bool AppInit2(boost::thread_group& threadGroup)
bool fDisableWallet = GetBoolArg("-disablewallet", false);
#endif
- if (mapArgs.count("-timeout"))
- {
- int nNewTimeout = GetArg("-timeout", 5000);
- if (nNewTimeout > 0 && nNewTimeout < 600000)
- nConnectTimeout = nNewTimeout;
- }
+ nConnectTimeout = GetArg("-timeout", DEFAULT_CONNECT_TIMEOUT);
+ if (nConnectTimeout <= 0)
+ nConnectTimeout = DEFAULT_CONNECT_TIMEOUT;
// Continue to put "/P2SH/" in the coinbase to monitor
// BIP16 support.
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 5819c152a3..b3d1001547 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -40,7 +40,7 @@ using namespace std;
static proxyType proxyInfo[NET_MAX];
static CService nameProxy;
static CCriticalSection cs_proxyInfos;
-int nConnectTimeout = 5000;
+int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT;
bool fNameLookup = false;
static const unsigned char pchIPv4[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };
diff --git a/src/netbase.h b/src/netbase.h
index 9fc5c72eb8..1455cd8c33 100644
--- a/src/netbase.h
+++ b/src/netbase.h
@@ -19,6 +19,9 @@
extern int nConnectTimeout;
extern bool fNameLookup;
+/** -timeout default */
+static const int DEFAULT_CONNECT_TIMEOUT = 5000;
+
#ifdef WIN32
// In MSVC, this is defined as a macro, undefine it to prevent a compile and link error
#undef SetPort