Merge branch 'atp' of https://github.com/birarda/hifi into protocol

This commit is contained in:
Atlante45 2015-07-28 13:50:15 -07:00
commit 71004ef519

View file

@ -89,10 +89,28 @@ void SendQueue::ack(SequenceNumber ack) {
return;
}
// remove any ACKed packets from the map of sent packets
QWriteLocker locker(&_sentLock);
for (auto seq = _lastAck; seq <= ack; ++seq) {
_sentPackets.erase(seq);
{
// remove any ACKed packets from the map of sent packets
QWriteLocker locker(&_sentLock);
for (auto seq = _lastAck; seq <= ack; ++seq) {
_sentPackets.erase(seq);
}
}
{
// remove any sequence numbers equal to or lower than this ACK in the loss list
QWriteLocker nakLocker(&_naksLock);
auto it = _naks.begin();
while (it != _naks.end()) {
if (*it <= ack) {
it = _naks.erase(it);
} else {
// the NAKs in the NAK list must be in order, so we can break if we hit one > ack
break;
}
}
}
_lastAck = ack;
@ -136,7 +154,7 @@ void SendQueue::sendNextPacket() {
}
}
// Find packet in sent list using SeqNum
// Find packet in sent list using SequenceNumber
if (hasResend) {
QWriteLocker locker(&_sentLock);
auto it = _sentPackets.find(seqNum);