Merge branch 'master' of github.com:highfidelity/hifi into debug-grab

This commit is contained in:
Seth Alves 2015-09-30 13:09:47 -07:00
commit 06f7f92951
6 changed files with 22 additions and 11 deletions

View file

@ -966,7 +966,8 @@ bool AvatarData::hasIdentityChangedAfterParsing(NLPacket& packet) {
QByteArray AvatarData::identityByteArray() {
QByteArray identityData;
QDataStream identityStream(&identityData, QIODevice::Append);
const QUrl& urlToSend = (_skeletonModelURL == AvatarData::defaultFullAvatarModelUrl()) ? QUrl("") : _skeletonModelURL;
QUrl emptyURL("");
const QUrl& urlToSend = (_skeletonModelURL == AvatarData::defaultFullAvatarModelUrl()) ? emptyURL : _skeletonModelURL;
identityStream << QUuid() << _faceModelURL << urlToSend << _attachmentData << _displayName;

View file

@ -23,7 +23,8 @@ std::unique_ptr<NLPacketList> NLPacketList::create(PacketType packetType, QByteA
}
std::unique_ptr<NLPacketList> NLPacketList::fromPacketList(std::unique_ptr<PacketList> packetList) {
auto nlPacketList = std::unique_ptr<NLPacketList>(new NLPacketList(std::move(*packetList.release()))); nlPacketList->open(ReadOnly);
auto nlPacketList = std::unique_ptr<NLPacketList>(new NLPacketList(std::move(*packetList.release())));
nlPacketList->open(ReadOnly);
return nlPacketList;
}

View file

@ -35,6 +35,7 @@ void SentPacketHistory::packetSent(uint16_t sequenceNumber, const NLPacket& pack
}
_newestSequenceNumber = sequenceNumber;
QWriteLocker locker(&_packetsLock);
_sentPackets.insert(NLPacket::createCopy(packet));
}
@ -48,6 +49,7 @@ const NLPacket* SentPacketHistory::getPacket(uint16_t sequenceNumber) const {
if (seqDiff < 0) {
seqDiff += UINT16_RANGE;
}
QReadLocker locker(&_packetsLock);
return _sentPackets.get(seqDiff)->get();
}

View file

@ -12,7 +12,9 @@
#define hifi_SentPacketHistory_h
#include <stdint.h>
#include <qbytearray.h>
#include <QtCore/QByteArray>
#include <QtCore/QReadWriteLock>
#include "NLPacket.h"
#include "RingBufferHistory.h"
@ -29,6 +31,7 @@ public:
const NLPacket* getPacket(uint16_t sequenceNumber) const;
private:
mutable QReadWriteLock _packetsLock { QReadWriteLock::Recursive };
RingBufferHistory<std::unique_ptr<NLPacket>> _sentPackets; // circular buffer
uint16_t _newestSequenceNumber;

View file

@ -161,13 +161,16 @@ void DefaultCC::onLoss(SequenceNumber rangeStart, SequenceNumber rangeEnd) {
_lastDecreaseMaxSeq = _sendCurrSeqNum;
// avoid synchronous rate decrease across connections using randomization
std::random_device rd;
std::mt19937 generator(rd());
std::uniform_int_distribution<> distribution(1, _avgNAKNum);
_randomDecreaseThreshold = distribution(generator);
if (_avgNAKNum < 1) {
_randomDecreaseThreshold = 1;
} else {
// avoid synchronous rate decrease across connections using randomization
std::random_device rd;
std::mt19937 generator(rd());
std::uniform_int_distribution<> distribution(1, std::max(1, _avgNAKNum));
_randomDecreaseThreshold = distribution(generator);
}
} else if ((_decreaseCount++ < MAX_DECREASES_PER_CONGESTION_EPOCH) && ((++_nakCount % _randomDecreaseThreshold) == 0)) {
// there have been fewer than MAX_DECREASES_PER_CONGESTION_EPOCH AND this NAK matches the random count at which we
// decided we would decrease the packet send period

View file

@ -346,6 +346,7 @@ void OctreeEditPacketSender::processNackPacket(NLPacket& packet, SharedNodePoint
if (_sentPacketHistories.count(sendingNode->getUUID()) == 0) {
return;
}
const SentPacketHistory& sentPacketHistory = _sentPacketHistories[sendingNode->getUUID()];
// read sequence numbers and queue packets for resend