mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-19 14:03:20 +02:00
use a mutable mutex to keep const-ness
This commit is contained in:
parent
f7e7b07441
commit
82ac0b1a27
3 changed files with 5 additions and 4 deletions
|
@ -39,7 +39,7 @@ void SentPacketHistory::packetSent(uint16_t sequenceNumber, const NLPacket& pack
|
|||
_sentPackets.insert(NLPacket::createCopy(packet));
|
||||
}
|
||||
|
||||
const NLPacket* SentPacketHistory::getPacket(uint16_t sequenceNumber) {
|
||||
const NLPacket* SentPacketHistory::getPacket(uint16_t sequenceNumber) const {
|
||||
|
||||
const int UINT16_RANGE = std::numeric_limits<uint16_t>::max() + 1;
|
||||
|
||||
|
|
|
@ -28,10 +28,10 @@ public:
|
|||
SentPacketHistory(int size = MAX_REASONABLE_SEQUENCE_GAP);
|
||||
|
||||
void packetSent(uint16_t sequenceNumber, const NLPacket& packet);
|
||||
const NLPacket* getPacket(uint16_t sequenceNumber);
|
||||
const NLPacket* getPacket(uint16_t sequenceNumber) const;
|
||||
|
||||
private:
|
||||
QReadWriteLock _packetsLock { QReadWriteLock::Recursive };
|
||||
mutable QReadWriteLock _packetsLock { QReadWriteLock::Recursive };
|
||||
RingBufferHistory<std::unique_ptr<NLPacket>> _sentPackets; // circular buffer
|
||||
|
||||
uint16_t _newestSequenceNumber;
|
||||
|
|
|
@ -346,7 +346,8 @@ void OctreeEditPacketSender::processNackPacket(NLPacket& packet, SharedNodePoint
|
|||
if (_sentPacketHistories.count(sendingNode->getUUID()) == 0) {
|
||||
return;
|
||||
}
|
||||
SentPacketHistory& sentPacketHistory = _sentPacketHistories[sendingNode->getUUID()];
|
||||
|
||||
const SentPacketHistory& sentPacketHistory = _sentPacketHistories[sendingNode->getUUID()];
|
||||
|
||||
// read sequence numbers and queue packets for resend
|
||||
while (packet.bytesLeftToRead() > 0) {
|
||||
|
|
Loading…
Reference in a new issue