mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 09:29:16 +02:00
Fix SequenceNumberStats, misc. clean-up
This commit is contained in:
parent
b409e04734
commit
1b0b280f3a
7 changed files with 15 additions and 15 deletions
|
@ -1021,7 +1021,7 @@ void DomainGatekeeper::refreshGroupsCache() {
|
|||
void DomainGatekeeper::initLocalIDManagement() {
|
||||
std::uniform_int_distribution<quint16> sixteenBitRand;
|
||||
std::random_device randomDevice;
|
||||
std::default_random_engine engine {randomDevice()};
|
||||
std::default_random_engine engine { randomDevice() };
|
||||
_currentLocalID = sixteenBitRand(engine);
|
||||
// Ensure increment is odd.
|
||||
_idIncrement = sixteenBitRand(engine) | 1;
|
||||
|
|
|
@ -135,7 +135,7 @@ private:
|
|||
UUIDToLocalID _uuidToLocalID;
|
||||
|
||||
Node::LocalID _currentLocalID;
|
||||
quint16 _idIncrement;
|
||||
Node::LocalID _idIncrement;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1159,7 +1159,7 @@ void DomainServer::handleConnectedNode(SharedNodePointer newNode) {
|
|||
|
||||
void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const HifiSockAddr &senderSockAddr) {
|
||||
const int NUM_DOMAIN_LIST_EXTENDED_HEADER_BYTES = NUM_BYTES_RFC4122_UUID + NLPacket::NUM_BYTES_LOCALID +
|
||||
NUM_BYTES_RFC4122_UUID + NLPacket::NUM_BYTES_LOCALID + 2;
|
||||
NUM_BYTES_RFC4122_UUID + NLPacket::NUM_BYTES_LOCALID + 4;
|
||||
|
||||
// setup the extended header for the domain list packets
|
||||
// this data is at the beginning of each of the domain list packets
|
||||
|
|
|
@ -120,8 +120,8 @@ int InboundAudioStream::parseData(ReceivedMessage& message) {
|
|||
// parse sequence number and track it
|
||||
quint16 sequence;
|
||||
message.readPrimitive(&sequence);
|
||||
SequenceNumberStats::ArrivalInfo arrivalInfo = _incomingSequenceNumberStats.sequenceNumberReceived(sequence, QUuid() // TBD
|
||||
/*message.getSourceID()*/);
|
||||
SequenceNumberStats::ArrivalInfo arrivalInfo =
|
||||
_incomingSequenceNumberStats.sequenceNumberReceived(sequence, message.getSourceID());
|
||||
QString codecInPacket = message.readString();
|
||||
|
||||
packetReceivedUpdateTimingStats();
|
||||
|
|
|
@ -136,7 +136,7 @@ Node::LocalID LimitedNodeList::getSessionLocalID() const {
|
|||
}
|
||||
|
||||
void LimitedNodeList::setSessionLocalID(Node::LocalID sessionLocalID) {
|
||||
QWriteLocker lock { &_sessionUUIDLock }; // Necessary?
|
||||
QWriteLocker lock { &_sessionUUIDLock };
|
||||
_sessionLocalID = sessionLocalID;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ SequenceNumberStats::SequenceNumberStats(int statsHistoryLength, bool canDetectO
|
|||
: _lastReceivedSequence(0),
|
||||
_missingSet(),
|
||||
_stats(),
|
||||
_lastSenderUUID(),
|
||||
_lastSenderID(0),
|
||||
_statsHistory(statsHistoryLength),
|
||||
_lastUnreasonableSequence(0),
|
||||
_consecutiveUnreasonableOnTime(0)
|
||||
|
@ -35,7 +35,7 @@ SequenceNumberStats::SequenceNumberStats(int statsHistoryLength, bool canDetectO
|
|||
void SequenceNumberStats::reset() {
|
||||
_missingSet.clear();
|
||||
_stats = PacketStreamStats();
|
||||
_lastSenderUUID = QUuid();
|
||||
_lastSenderID = 0;
|
||||
_statsHistory.clear();
|
||||
_lastUnreasonableSequence = 0;
|
||||
_consecutiveUnreasonableOnTime = 0;
|
||||
|
@ -43,18 +43,18 @@ void SequenceNumberStats::reset() {
|
|||
|
||||
static const int UINT16_RANGE = std::numeric_limits<uint16_t>::max() + 1;
|
||||
|
||||
SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(quint16 incoming, QUuid senderUUID, const bool wantExtraDebugging) {
|
||||
SequenceNumberStats::ArrivalInfo SequenceNumberStats::sequenceNumberReceived(quint16 incoming, NetworkLocalID senderID, const bool wantExtraDebugging) {
|
||||
|
||||
SequenceNumberStats::ArrivalInfo arrivalInfo;
|
||||
|
||||
// if the sender node has changed, reset all stats
|
||||
if (senderUUID != _lastSenderUUID) {
|
||||
if (senderID != _lastSenderID) {
|
||||
if (_stats._received > 0) {
|
||||
qCDebug(networking) << "sequence number stats was reset due to new sender node";
|
||||
qCDebug(networking) << "previous:" << _lastSenderUUID << "current:" << senderUUID;
|
||||
qCDebug(networking) << "previous:" << _lastSenderID << "current:" << senderID;
|
||||
reset();
|
||||
}
|
||||
_lastSenderUUID = senderUUID;
|
||||
_lastSenderID = senderID;
|
||||
}
|
||||
|
||||
// determine our expected sequence number... handle rollover appropriately
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "SharedUtil.h"
|
||||
#include "RingBufferHistory.h"
|
||||
#include <quuid.h>
|
||||
#include "UUID.h"
|
||||
|
||||
const int MAX_REASONABLE_SEQUENCE_GAP = 1000;
|
||||
|
||||
|
@ -73,7 +73,7 @@ public:
|
|||
SequenceNumberStats(int statsHistoryLength = 0, bool canDetectOutOfSync = true);
|
||||
|
||||
void reset();
|
||||
ArrivalInfo sequenceNumberReceived(quint16 incoming, QUuid senderUUID = QUuid(), const bool wantExtraDebugging = false);
|
||||
ArrivalInfo sequenceNumberReceived(quint16 incoming, NetworkLocalID senderID = 0, const bool wantExtraDebugging = false);
|
||||
void pruneMissingSet(const bool wantExtraDebugging = false);
|
||||
void pushStatsToHistory() { _statsHistory.insert(_stats); }
|
||||
|
||||
|
@ -100,7 +100,7 @@ private:
|
|||
|
||||
PacketStreamStats _stats;
|
||||
|
||||
QUuid _lastSenderUUID;
|
||||
NetworkLocalID _lastSenderID;
|
||||
|
||||
RingBufferHistory<PacketStreamStats> _statsHistory;
|
||||
|
||||
|
|
Loading…
Reference in a new issue