mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Require longer delays before disconnecting peers
This commit is contained in:
@@ -537,6 +537,17 @@ PeerImp::onTimer (error_code const& ec)
|
|||||||
send (std::make_shared<Message> (
|
send (std::make_shared<Message> (
|
||||||
message, protocol::mtPING));
|
message, protocol::mtPING));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We have an outstanding ping, raise latency
|
||||||
|
auto minLatency = std::chrono::duration_cast <std::chrono::milliseconds>
|
||||||
|
(clock_type::now() - lastPingTime_);
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> sl(recentLock_);
|
||||||
|
|
||||||
|
if (latency_ < minLatency)
|
||||||
|
latency_ = minLatency;
|
||||||
|
}
|
||||||
|
|
||||||
setTimer();
|
setTimer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,16 +54,16 @@ enum
|
|||||||
checkSeconds = 10,
|
checkSeconds = 10,
|
||||||
|
|
||||||
/** How often we latency/sendq probe connections */
|
/** How often we latency/sendq probe connections */
|
||||||
timerSeconds = 3,
|
timerSeconds = 4,
|
||||||
|
|
||||||
/** How many timer intervals a sendq has to stay large before we disconnect */
|
/** How many timer intervals a sendq has to stay large before we disconnect */
|
||||||
sendqIntervals = 3,
|
sendqIntervals = 4,
|
||||||
|
|
||||||
/** How many timer intervals we can go without a ping reply */
|
/** How many timer intervals we can go without a ping reply */
|
||||||
noPing = 4,
|
noPing = 10,
|
||||||
|
|
||||||
/** How many messages on a send queue before we refuse queries */
|
/** How many messages on a send queue before we refuse queries */
|
||||||
dropSendQueue = 5,
|
dropSendQueue = 8,
|
||||||
|
|
||||||
/** How many messages we consider reasonable sustained on a send queue */
|
/** How many messages we consider reasonable sustained on a send queue */
|
||||||
targetSendQueue = 16,
|
targetSendQueue = 16,
|
||||||
|
|||||||
Reference in New Issue
Block a user