Merge pull request #15794 from SimonWalton-HiFi/limit-stats-dump-rate

Limit the stats-dump rate on packet error
This commit is contained in:
Howard Stearns 2019-06-19 11:14:48 -07:00 committed by GitHub
commit ff1d828aaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View file

@ -450,13 +450,16 @@ qint64 LimitedNodeList::sendPacket(std::unique_ptr<NLPacket> packet, const HifiS
auto size = sendUnreliablePacket(*packet, sockAddr, hmacAuth);
if (size < 0) {
auto now = usecTimestampNow();
eachNode([now](const SharedNodePointer & node) {
qCDebug(networking) << "Stats for " << node->getPublicSocket() << "\n"
<< " Last Heard Microstamp: " << node->getLastHeardMicrostamp() << " (" << (now - node->getLastHeardMicrostamp()) << "usec ago)\n"
<< " Outbound Kbps: " << node->getOutboundKbps() << "\n"
<< " Inbound Kbps: " << node->getInboundKbps() << "\n"
<< " Ping: " << node->getPingMs();
});
if (now - _sendErrorStatsTime > ERROR_STATS_PERIOD_US) {
_sendErrorStatsTime = now;
eachNode([now](const SharedNodePointer& node) {
qCDebug(networking) << "Stats for " << node->getPublicSocket() << "\n"
<< " Last Heard Microstamp: " << node->getLastHeardMicrostamp() << " (" << (now - node->getLastHeardMicrostamp()) << "usec ago)\n"
<< " Outbound Kbps: " << node->getOutboundKbps() << "\n"
<< " Inbound Kbps: " << node->getInboundKbps() << "\n"
<< " Ping: " << node->getPingMs();
});
}
}
return size;
}

View file

@ -497,6 +497,9 @@ private:
float _outboundKbps { 0.0f };
bool _dropOutgoingNodeTraffic { false };
quint64 _sendErrorStatsTime { (quint64)0 };
static const quint64 ERROR_STATS_PERIOD_US { 1 * USECS_PER_SECOND };
};
#endif // hifi_LimitedNodeList_h