From 6643633400e2049c1699f84272985872fe8c4e14 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 7 Jun 2019 13:38:50 -0700 Subject: [PATCH] Move rebind on network error to rebind on silent domain checkin --- libraries/networking/src/NodeList.cpp | 6 ++++++ libraries/networking/src/udt/Socket.cpp | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 038d656dbb..0e6b5503d7 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -438,7 +438,13 @@ void NodeList::sendDomainServerCheckIn() { // Send duplicate check-ins in the exponentially increasing sequence 1, 1, 2, 4, ... static const int MAX_CHECKINS_TOGETHER = 20; + static const int REBIND_CHECKIN_COUNT = 2; int outstandingCheckins = _domainHandler.getCheckInPacketsSinceLastReply(); + + if (outstandingCheckins > REBIND_CHECKIN_COUNT) { + _nodeSocket.rebind(); + } + int checkinCount = outstandingCheckins > 1 ? std::pow(2, outstandingCheckins - 2) : 1; checkinCount = std::min(checkinCount, MAX_CHECKINS_TOGETHER); for (int i = 1; i < checkinCount; ++i) { diff --git a/libraries/networking/src/udt/Socket.cpp b/libraries/networking/src/udt/Socket.cpp index c73ac8109f..0abe1eb172 100644 --- a/libraries/networking/src/udt/Socket.cpp +++ b/libraries/networking/src/udt/Socket.cpp @@ -508,10 +508,6 @@ void Socket::handleSocketError(QAbstractSocket::SocketError socketError) { int nodeListQueueSize = ::hifi::qt::getEventQueueSize(thread()); qCDebug(networking) << "Networking queue size - " << nodeListQueueSize; #endif // DEBUG_EVENT_QUEUE - - if (_udpSocket.state() == QAbstractSocket::BoundState) { - rebind(); - } } void Socket::handleStateChanged(QAbstractSocket::SocketState socketState) {