Browse Source

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.
0.13
Kaz Wesley 9 years ago
parent
commit
d3d02d5145
  1. 3
      src/main.cpp

3
src/main.cpp

@ -5713,6 +5713,9 @@ bool SendMessages(CNode* pto)
pto->vAddrToSend.clear(); pto->vAddrToSend.clear();
if (!vAddr.empty()) if (!vAddr.empty())
pto->PushMessage(NetMsgType::ADDR, vAddr); 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()); CNodeState &state = *State(pto->GetId());

Loading…
Cancel
Save