diff --git a/libraries/networking/src/SentPacketHistory.cpp b/libraries/networking/src/SentPacketHistory.cpp index d0fcecd171..14b4677fc3 100644 --- a/libraries/networking/src/SentPacketHistory.cpp +++ b/libraries/networking/src/SentPacketHistory.cpp @@ -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::max() + 1; diff --git a/libraries/networking/src/SentPacketHistory.h b/libraries/networking/src/SentPacketHistory.h index 78b6914c2d..72150658e3 100644 --- a/libraries/networking/src/SentPacketHistory.h +++ b/libraries/networking/src/SentPacketHistory.h @@ -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> _sentPackets; // circular buffer uint16_t _newestSequenceNumber; diff --git a/libraries/octree/src/OctreeEditPacketSender.cpp b/libraries/octree/src/OctreeEditPacketSender.cpp index d4bd939196..495effc825 100644 --- a/libraries/octree/src/OctreeEditPacketSender.cpp +++ b/libraries/octree/src/OctreeEditPacketSender.cpp @@ -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) {