aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-11-13 13:26:42 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-11-13 13:27:33 +0100
commitd2e987aa19295e5da40b843aad7970f781a96ccd (patch)
tree165f0201e2e392a8ddb81af20e8111cdf19a82b1 /src
parent24c4841d16862c201bf62218280c2194a85a81ca (diff)
parent9c3ee3bf77382aca5717f9ae7163e79e3bf836af (diff)
downloadbitcoin-d2e987aa19295e5da40b843aad7970f781a96ccd.tar.xz
Merge pull request #6958
9c3ee3b [doc] Add -maxuploadtarget release notes (MarcoFalke) b27e81f [net] Cleanup maxuploadtarget (MarcoFalke)
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp4
-rw-r--r--src/net.cpp4
-rw-r--r--src/net.h2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 87a23deab7..a83a136fa5 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -375,7 +375,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-whitebind=<addr>", _("Bind to given address and whitelist peers connecting to it. Use [host]:port notation for IPv6"));
strUsage += HelpMessageOpt("-whitelist=<netmask>", _("Whitelist peers connecting from the given netmask or IP address. Can be specified multiple times.") +
" " + _("Whitelisted peers cannot be DoS banned and their transactions are always relayed, even if they are already in the mempool, useful e.g. for a gateway"));
- strUsage += HelpMessageOpt("-maxuploadtarget=<n>", strprintf(_("Tries to keep outbound traffic under the given target (in MiB per 24h), 0 = no limit (default: %d)"), 0));
+ strUsage += HelpMessageOpt("-maxuploadtarget=<n>", strprintf(_("Tries to keep outbound traffic under the given target (in MiB per 24h), 0 = no limit (default: %d)"), DEFAULT_MAX_UPLOAD_TARGET));
#ifdef ENABLE_WALLET
strUsage += HelpMessageGroup(_("Wallet options:"));
@@ -1193,7 +1193,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
#endif
if (mapArgs.count("-maxuploadtarget")) {
- CNode::SetMaxOutboundTarget(GetArg("-maxuploadtarget", 0)*1024*1024);
+ CNode::SetMaxOutboundTarget(GetArg("-maxuploadtarget", DEFAULT_MAX_UPLOAD_TARGET)*1024*1024);
}
// ********************************************************* Step 7: load block chain
diff --git a/src/net.cpp b/src/net.cpp
index ada4a1bb62..1ea50b2493 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2117,8 +2117,8 @@ void CNode::SetMaxOutboundTarget(uint64_t limit)
uint64_t recommendedMinimum = (nMaxOutboundTimeframe / 600) * MAX_BLOCK_SIZE;
nMaxOutboundLimit = limit;
- if (limit < recommendedMinimum)
- LogPrintf("Max outbound target is very small (%s) and will be overshot. Recommended minimum is %s\n.", nMaxOutboundLimit, recommendedMinimum);
+ if (limit > 0 && limit < recommendedMinimum)
+ LogPrintf("Max outbound target is very small (%s bytes) and will be overshot. Recommended minimum is %s bytes.\n", nMaxOutboundLimit, recommendedMinimum);
}
uint64_t CNode::GetMaxOutboundTarget()
diff --git a/src/net.h b/src/net.h
index d89244523e..cd2d225d73 100644
--- a/src/net.h
+++ b/src/net.h
@@ -60,6 +60,8 @@ static const bool DEFAULT_UPNP = false;
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
/** The maximum number of peer connections to maintain. */
static const unsigned int DEFAULT_MAX_PEER_CONNECTIONS = 125;
+/** The default for -maxuploadtarget. 0 = Unlimited */
+static const uint64_t DEFAULT_MAX_UPLOAD_TARGET = 0;
unsigned int ReceiveFloodSize();
unsigned int SendBufferSize();