From 12db6a4d1011984bff5af4f5c66dfc6c84f0a8ec Mon Sep 17 00:00:00 2001 From: Simon Walton Date: Mon, 8 Oct 2018 10:58:46 -0700 Subject: [PATCH] Limit number of domain-checkin duplicates --- libraries/networking/src/NodeList.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index e458ffab7e..62c061249f 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -428,8 +428,10 @@ void NodeList::sendDomainServerCheckIn() { flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::SendDSCheckIn); // Send duplicate check-ins in the exponentially increasing sequence 1, 1, 2, 4, ... + static const int MAX_CHECKINS_TOGETHER = 20; int outstandingCheckins = _domainHandler.getCheckInPacketsSinceLastReply(); int checkinCount = outstandingCheckins > 1 ? std::pow(2, outstandingCheckins - 2) : 1; + checkinCount = std::min(checkinCount, MAX_CHECKINS_TOGETHER); for (int i = 1; i < checkinCount; ++i) { auto packetCopy = domainPacket->createCopy(*domainPacket); sendPacket(std::move(packetCopy), _domainHandler.getSockAddr());