mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-24 01:14:15 +02:00
Merge pull request #15771 from roxanneskelly/bugz516
BUGZ-696 Drop non DS UDP packets when silent domain checkins exceeds 3 seconds
This commit is contained in:
commit
723b4ac30f
5 changed files with 30 additions and 12 deletions
|
@ -1735,7 +1735,12 @@ void DomainServer::nodePingMonitor() {
|
||||||
nodeList->eachNode([now](const SharedNodePointer& node) {
|
nodeList->eachNode([now](const SharedNodePointer& node) {
|
||||||
quint64 lastHeard = now - node->getLastHeardMicrostamp();
|
quint64 lastHeard = now - node->getLastHeardMicrostamp();
|
||||||
if (lastHeard > 2 * USECS_PER_SECOND) {
|
if (lastHeard > 2 * USECS_PER_SECOND) {
|
||||||
qCDebug(domain_server) << "Haven't heard from " << node->getPublicSocket() << " in " << lastHeard / USECS_PER_MSEC << " msec";
|
QString username;
|
||||||
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||||
|
if (nodeData) {
|
||||||
|
username = nodeData->getUsername();
|
||||||
|
}
|
||||||
|
qCDebug(domain_server) << "Haven't heard from " << node->getPublicSocket() << username << " in " << lastHeard / USECS_PER_MSEC << " msec";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -559,6 +559,8 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer<Rec
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const int SILENT_DOMAIN_TRAFFIC_DROP_MIN = 2;
|
||||||
|
|
||||||
bool DomainHandler::checkInPacketTimeout() {
|
bool DomainHandler::checkInPacketTimeout() {
|
||||||
++_checkInPacketsSinceLastReply;
|
++_checkInPacketsSinceLastReply;
|
||||||
|
|
||||||
|
@ -566,10 +568,15 @@ bool DomainHandler::checkInPacketTimeout() {
|
||||||
qCDebug(networking_ice) << "Silent domain checkins:" << _checkInPacketsSinceLastReply;
|
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 > SILENT_DOMAIN_TRAFFIC_DROP_MIN) {
|
||||||
|
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
|
// 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
|
||||||
|
|
||||||
|
|
|
@ -409,6 +409,16 @@ qint64 LimitedNodeList::sendUnreliablePacket(const NLPacket& packet, const HifiS
|
||||||
Q_ASSERT_X(!packet.isReliable(), "LimitedNodeList::sendUnreliablePacket",
|
Q_ASSERT_X(!packet.isReliable(), "LimitedNodeList::sendUnreliablePacket",
|
||||||
"Trying to send a reliable packet unreliably.");
|
"Trying to send a reliable packet unreliably.");
|
||||||
|
|
||||||
|
if (_dropOutgoingNodeTraffic) {
|
||||||
|
auto destinationNode = findNodeWithAddr(sockAddr);
|
||||||
|
|
||||||
|
// findNodeWithAddr returns null for the address of the domain server
|
||||||
|
if (!destinationNode.isNull()) {
|
||||||
|
// This only suppresses individual unreliable packets, not unreliable packet lists
|
||||||
|
return ERROR_SENDING_PACKET_BYTES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fillPacketHeader(packet, hmacAuth);
|
fillPacketHeader(packet, hmacAuth);
|
||||||
|
|
||||||
return _nodeSocket.writePacket(packet, sockAddr);
|
return _nodeSocket.writePacket(packet, sockAddr);
|
||||||
|
|
|
@ -335,6 +335,8 @@ public:
|
||||||
float getInboundKbps() const { return _inboundKbps; }
|
float getInboundKbps() const { return _inboundKbps; }
|
||||||
float getOutboundKbps() const { return _outboundKbps; }
|
float getOutboundKbps() const { return _outboundKbps; }
|
||||||
|
|
||||||
|
void setDropOutgoingNodeTraffic(bool squelchOutgoingNodeTraffic) { _dropOutgoingNodeTraffic = squelchOutgoingNodeTraffic; }
|
||||||
|
|
||||||
const std::set<NodeType_t> SOLO_NODE_TYPES = {
|
const std::set<NodeType_t> SOLO_NODE_TYPES = {
|
||||||
NodeType::AvatarMixer,
|
NodeType::AvatarMixer,
|
||||||
NodeType::AudioMixer,
|
NodeType::AudioMixer,
|
||||||
|
@ -493,6 +495,8 @@ private:
|
||||||
int _outboundPPS { 0 };
|
int _outboundPPS { 0 };
|
||||||
float _inboundKbps { 0.0f };
|
float _inboundKbps { 0.0f };
|
||||||
float _outboundKbps { 0.0f };
|
float _outboundKbps { 0.0f };
|
||||||
|
|
||||||
|
bool _dropOutgoingNodeTraffic { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_LimitedNodeList_h
|
#endif // hifi_LimitedNodeList_h
|
||||||
|
|
|
@ -452,16 +452,7 @@ void NodeList::sendDomainServerCheckIn() {
|
||||||
// Send duplicate check-ins in the exponentially increasing sequence 1, 1, 2, 4, ...
|
// Send duplicate check-ins in the exponentially increasing sequence 1, 1, 2, 4, ...
|
||||||
static const int MAX_CHECKINS_TOGETHER = 20;
|
static const int MAX_CHECKINS_TOGETHER = 20;
|
||||||
int outstandingCheckins = _domainHandler.getCheckInPacketsSinceLastReply();
|
int outstandingCheckins = _domainHandler.getCheckInPacketsSinceLastReply();
|
||||||
/*
|
|
||||||
static const int WARNING_CHECKIN_COUNT = 2;
|
|
||||||
if (outstandingCheckins > WARNING_CHECKIN_COUNT) {
|
|
||||||
// We may be headed for a disconnect, as we've written two DomainListRequests without getting anything back.
|
|
||||||
// In some cases, we've found that nothing is going out on the wire despite not getting any errors from
|
|
||||||
// sendPacket => writeDatagram, below. In at least some such cases, we've found that the DomainDisconnectRequest
|
|
||||||
// does go through, so let's at least try to mix it up with a different safe packet.
|
|
||||||
// TODO: send ICEPing, and later on tell the other nodes to shut up for a moment.
|
|
||||||
|
|
||||||
}*/
|
|
||||||
int checkinCount = outstandingCheckins > 1 ? std::pow(2, outstandingCheckins - 2) : 1;
|
int checkinCount = outstandingCheckins > 1 ? std::pow(2, outstandingCheckins - 2) : 1;
|
||||||
checkinCount = std::min(checkinCount, MAX_CHECKINS_TOGETHER);
|
checkinCount = std::min(checkinCount, MAX_CHECKINS_TOGETHER);
|
||||||
for (int i = 1; i < checkinCount; ++i) {
|
for (int i = 1; i < checkinCount; ++i) {
|
||||||
|
@ -715,6 +706,7 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
|
||||||
|
|
||||||
// this is a packet from the domain server, reset the count of un-replied check-ins
|
// this is a packet from the domain server, reset the count of un-replied check-ins
|
||||||
_domainHandler.clearPendingCheckins();
|
_domainHandler.clearPendingCheckins();
|
||||||
|
setDropOutgoingNodeTraffic(false);
|
||||||
|
|
||||||
// emit our signal so listeners know we just heard from the DS
|
// emit our signal so listeners know we just heard from the DS
|
||||||
emit receivedDomainServerList();
|
emit receivedDomainServerList();
|
||||||
|
|
Loading…
Reference in a new issue