mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-04 02:31:21 +02:00
Merge pull request #13458 from SimonWalton-HiFi/aggressive-domain-checkins
Send repeated check-in requests for greater resilience
This commit is contained in:
commit
f2d0f1ffbc
3 changed files with 16 additions and 7 deletions
|
@ -475,13 +475,16 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainHandler::sentCheckInPacket() {
|
bool DomainHandler::checkInPacketTimeout() {
|
||||||
++_checkInPacketsSinceLastReply;
|
++_checkInPacketsSinceLastReply;
|
||||||
|
|
||||||
if (_checkInPacketsSinceLastReply >= MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
|
if (_checkInPacketsSinceLastReply > MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
|
||||||
// we haven't heard back from DS in MAX_SILENT_DOMAIN_SERVER_CHECK_INS
|
// we haven't heard back from DS in MAX_SILENT_DOMAIN_SERVER_CHECK_INS
|
||||||
// so emit our signal that says that
|
// so emit our signal that says that
|
||||||
qCDebug(networking) << "Limit of silent domain checkins reached";
|
qCDebug(networking) << "Limit of silent domain checkins reached";
|
||||||
emit limitOfSilentDomainCheckInsReached();
|
emit limitOfSilentDomainCheckInsReached();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ public:
|
||||||
void softReset();
|
void softReset();
|
||||||
|
|
||||||
int getCheckInPacketsSinceLastReply() const { return _checkInPacketsSinceLastReply; }
|
int getCheckInPacketsSinceLastReply() const { return _checkInPacketsSinceLastReply; }
|
||||||
void sentCheckInPacket();
|
bool checkInPacketTimeout();
|
||||||
void clearPendingCheckins() { _checkInPacketsSinceLastReply = 0; }
|
void clearPendingCheckins() { _checkInPacketsSinceLastReply = 0; }
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
|
|
@ -305,7 +305,8 @@ void NodeList::sendDomainServerCheckIn() {
|
||||||
} else if (_domainHandler.getIP().isNull() && _domainHandler.requiresICE()) {
|
} else if (_domainHandler.getIP().isNull() && _domainHandler.requiresICE()) {
|
||||||
qCDebug(networking) << "Waiting for ICE discovered domain-server socket. Will not send domain-server check in.";
|
qCDebug(networking) << "Waiting for ICE discovered domain-server socket. Will not send domain-server check in.";
|
||||||
handleICEConnectionToDomainServer();
|
handleICEConnectionToDomainServer();
|
||||||
} else if (!_domainHandler.getIP().isNull()) {
|
// let the domain handler know we are due to send a checkin packet
|
||||||
|
} else if (!_domainHandler.getIP().isNull() && !_domainHandler.checkInPacketTimeout()) {
|
||||||
|
|
||||||
PacketType domainPacketType = !_domainHandler.isConnected()
|
PacketType domainPacketType = !_domainHandler.isConnected()
|
||||||
? PacketType::DomainConnectRequest : PacketType::DomainListRequest;
|
? PacketType::DomainConnectRequest : PacketType::DomainListRequest;
|
||||||
|
@ -419,10 +420,15 @@ void NodeList::sendDomainServerCheckIn() {
|
||||||
|
|
||||||
flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::SendDSCheckIn);
|
flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::SendDSCheckIn);
|
||||||
|
|
||||||
|
// Send duplicate check-ins in the exponentially increasing sequence 1, 1, 2, 4, ...
|
||||||
|
int outstandingCheckins = _domainHandler.getCheckInPacketsSinceLastReply();
|
||||||
|
int checkinCount = outstandingCheckins > 1 ? std::pow(2, outstandingCheckins - 2) : 1;
|
||||||
|
for (int i = 1; i < checkinCount; ++i) {
|
||||||
|
auto packetCopy = domainPacket->createCopy(*domainPacket);
|
||||||
|
sendPacket(std::move(packetCopy), _domainHandler.getSockAddr());
|
||||||
|
}
|
||||||
sendPacket(std::move(domainPacket), _domainHandler.getSockAddr());
|
sendPacket(std::move(domainPacket), _domainHandler.getSockAddr());
|
||||||
|
|
||||||
// let the domain handler know we sent another check in or connect packet
|
|
||||||
_domainHandler.sentCheckInPacket();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue