aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2020-10-15 07:26:08 +0800
committerfanquake <fanquake@gmail.com>2020-10-15 07:59:19 +0800
commit661fe5d65cc6516439f9d6e0f1a5e2db0e129059 (patch)
tree2c4adf8a7e9c7314cf161b92dd37de319f7c6db0
parentc2c4dbaebd955ad2829364f7fa5b8169ca1ba6b9 (diff)
parentfa1f6f237d02265af616129402fa2b8a3019dda5 (diff)
Merge #20146: net: Send post-verack handshake messages at most once
fa1f6f237d02265af616129402fa2b8a3019dda5 net: Send post-verack handshake messages at most once (MarcoFalke) Pull request description: There is no need to send `SENDHEADERS` and `SENDCMPCT` messages as a reply to each `VERACK` that is received. For alive checks, a `PING`/`PONG` can be used. ACKs for top commit: jonatack: Concept ACK fa1f6f237d02265af616129402fa2b8a3019dda5 this is the only code section that sets `fCurrentlyConnected` and `fSuccessfullyConnected` to true. Could add a test. I did not verify if this code is actually being called repeatedly post initial verack; was it? hebasto: ACK fa1f6f237d02265af616129402fa2b8a3019dda5, I have reviewed the code and it looks OK, I agree it can be merged. naumenkogs: ACK fa1f6f237d02265af616129402fa2b8a3019dda5 laanwj: Code review ACK fa1f6f237d02265af616129402fa2b8a3019dda5 Tree-SHA512: c841d5d3807254a49463bbcfac3b32881b34a9d3206899544c86322c20988e17ad2ae243cba227fd3825a914f0cb2584451edda2414aecee6d5e3f5a0636f08a
-rw-r--r--src/net_processing.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 74f3390fee..f14db379fb 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2462,8 +2462,9 @@ void PeerManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDat
// At this point, the outgoing message serialization version can't change.
const CNetMsgMaker msgMaker(pfrom.GetCommonVersion());
- if (msg_type == NetMsgType::VERACK)
- {
+ if (msg_type == NetMsgType::VERACK) {
+ if (pfrom.fSuccessfullyConnected) return;
+
if (!pfrom.IsInboundConn()) {
// Mark this node as currently connected, so we update its timestamp later.
LOCK(cs_main);