aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorKaz Wesley <[email protected]>2016-06-06 14:42:34 -0700
committerKaz Wesley <[email protected]>2016-06-06 15:57:40 -0700
commitd3d02d51453943bfe3a9edb944eb48f9f1e01aca (patch)
tree3eacee81c035c2056ce6543bb6df2fe6693e646a /src/main.cpp
parentMerge #8142: Improve CWallet API with new GetAccountPubkey function. (diff)
downloaddiscoin-d3d02d51453943bfe3a9edb944eb48f9f1e01aca.tar.xz
discoin-d3d02d51453943bfe3a9edb944eb48f9f1e01aca.zip
drop vAddrToSend after sending big addr message
We send a newly-accepted peer a 1000-entry addr message, and then only use vAddrToSend for small messages. Deallocate vAddrToSend after it's been used for the big message to save about 40 kB per connected inbound peer.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index fc8e72a7d..5fff4187a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5713,6 +5713,9 @@ bool SendMessages(CNode* pto)
pto->vAddrToSend.clear();
if (!vAddr.empty())
pto->PushMessage(NetMsgType::ADDR, vAddr);
+ // we only send the big addr message once
+ if (pto->vAddrToSend.capacity() > 40)
+ pto->vAddrToSend.shrink_to_fit();
}
CNodeState &state = *State(pto->GetId());