When missing domain checkins, drop packets not destined for DS

This commit is contained in:
Roxanne Skelly 2019-06-13 17:25:35 -07:00
parent 91dce827a5
commit 3d2b1dbf2b
4 changed files with 19 additions and 2 deletions

View file

@ -566,9 +566,14 @@ bool DomainHandler::checkInPacketTimeout() {
qCDebug(networking_ice) << "Silent domain checkins:" << _checkInPacketsSinceLastReply;
}
if (_checkInPacketsSinceLastReply > MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
auto nodeList = DependencyManager::get<NodeList>();
auto nodeList = DependencyManager::get<NodeList>();
if(_checkInPacketsSinceLastReply > 2) {
qCDebug(networking_ice) << _checkInPacketsSinceLastReply << "seconds since last domain list request, squelching traffic";
nodeList->setDropOutgoingNodeTraffic(true);
}
if (_checkInPacketsSinceLastReply > 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

View file

@ -409,6 +409,13 @@ qint64 LimitedNodeList::sendUnreliablePacket(const NLPacket& packet, const HifiS
Q_ASSERT_X(!packet.isReliable(), "LimitedNodeList::sendUnreliablePacket",
"Trying to send a reliable packet unreliably.");
if(_dropOutgoingNodeTraffic) {
auto destinationNode = findNodeWithAddr(sockAddr);
if (!destinationNode.isNull() && (destinationNode->getType() != NodeType::DomainServer)) {
return ERROR_SENDING_PACKET_BYTES;
}
}
fillPacketHeader(packet, hmacAuth);
return _nodeSocket.writePacket(packet, sockAddr);

View file

@ -335,6 +335,8 @@ public:
float getInboundKbps() const { return _inboundKbps; }
float getOutboundKbps() const { return _outboundKbps; }
void setDropOutgoingNodeTraffic(bool squelchOutgoingNodeTraffic) { _dropOutgoingNodeTraffic = squelchOutgoingNodeTraffic; }
const std::set<NodeType_t> SOLO_NODE_TYPES = {
NodeType::AvatarMixer,
NodeType::AudioMixer,
@ -493,6 +495,8 @@ private:
int _outboundPPS { 0 };
float _inboundKbps { 0.0f };
float _outboundKbps { 0.0f };
bool _dropOutgoingNodeTraffic { false };
};
#endif // hifi_LimitedNodeList_h

View file

@ -710,6 +710,7 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
// this is a packet from the domain server, reset the count of un-replied check-ins
_domainHandler.clearPendingCheckins();
setDropOutgoingNodeTraffic(false);
// emit our signal so listeners know we just heard from the DS
emit receivedDomainServerList();