From 8042bbfbf001d60feead6f04c99e0fca93dbba3c Mon Sep 17 00:00:00 2001 From: Zain Iqbal Allarakhia Date: Thu, 15 Nov 2018 15:30:26 -0800 Subject: p2p: allow p2ptimeout to be configurable, speed up slow test --- src/net.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index 164ec9080c..07f4b5fc13 100644 --- a/src/net.h +++ b/src/net.h @@ -78,6 +78,8 @@ static const uint64_t DEFAULT_MAX_UPLOAD_TARGET = 0; static const uint64_t MAX_UPLOAD_TIMEFRAME = 60 * 60 * 24; /** Default for blocks only*/ static const bool DEFAULT_BLOCKSONLY = false; +/** -peertimeout default */ +static const int64_t DEFAULT_PEER_CONNECT_TIMEOUT = 60; static const bool DEFAULT_FORCEDNSSEED = false; static const size_t DEFAULT_MAXRECEIVEBUFFER = 5 * 1000; @@ -138,6 +140,7 @@ public: unsigned int nReceiveFloodSize = 0; uint64_t nMaxOutboundTimeframe = 0; uint64_t nMaxOutboundLimit = 0; + int64_t m_peer_connect_timeout = DEFAULT_PEER_CONNECT_TIMEOUT; std::vector vSeedNodes; std::vector vWhitelistedRange; std::vector vBinds, vWhiteBinds; @@ -158,6 +161,7 @@ public: m_msgproc = connOptions.m_msgproc; nSendBufferMaxSize = connOptions.nSendBufferMaxSize; nReceiveFloodSize = connOptions.nReceiveFloodSize; + m_peer_connect_timeout = connOptions.m_peer_connect_timeout; { LOCK(cs_totalBytesSent); nMaxOutboundTimeframe = connOptions.nMaxOutboundTimeframe; @@ -391,6 +395,9 @@ private: uint64_t nMaxOutboundLimit GUARDED_BY(cs_totalBytesSent); uint64_t nMaxOutboundTimeframe GUARDED_BY(cs_totalBytesSent); + // P2P timeout in seconds + int64_t m_peer_connect_timeout; + // Whitelisted ranges. Any node connecting from these is automatically // whitelisted (as well as those connecting to whitelisted binds). std::vector vWhitelistedRange; -- cgit v1.2.3