From 000232a55d838cddb43ce8c21979d1b61b71f19f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 15 Jul 2015 17:59:37 -0700 Subject: [PATCH 1/3] fix copied packet buffer creation --- libraries/networking/src/udt/Packet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/udt/Packet.cpp b/libraries/networking/src/udt/Packet.cpp index 56c5a1c389..0a174a2820 100644 --- a/libraries/networking/src/udt/Packet.cpp +++ b/libraries/networking/src/udt/Packet.cpp @@ -106,7 +106,7 @@ Packet& Packet::operator=(const Packet& other) { _type = other._type; _packetSize = other._packetSize; - _packet = std::unique_ptr(new char(_packetSize)); + _packet = std::unique_ptr(new char[_packetSize]); memcpy(_packet.get(), other._packet.get(), _packetSize); _payloadStart = _packet.get() + (other._payloadStart - other._packet.get()); From 6fa17dafffab54833b7ebb7e10f894758ba7b546 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 15 Jul 2015 18:27:43 -0700 Subject: [PATCH 2/3] open packets for write with ReadWrite --- libraries/networking/src/NLPacket.cpp | 2 +- libraries/networking/src/udt/Packet.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/NLPacket.cpp b/libraries/networking/src/NLPacket.cpp index 5d996fc9b8..c34e589eff 100644 --- a/libraries/networking/src/NLPacket.cpp +++ b/libraries/networking/src/NLPacket.cpp @@ -41,7 +41,7 @@ std::unique_ptr NLPacket::create(PacketType::Value type, qint64 size) packet = std::unique_ptr(new NLPacket(type, size)); } - packet->open(QIODevice::WriteOnly); + packet->open(QIODevice::ReadWrite); return packet; } diff --git a/libraries/networking/src/udt/Packet.cpp b/libraries/networking/src/udt/Packet.cpp index 0a174a2820..6abb87f861 100644 --- a/libraries/networking/src/udt/Packet.cpp +++ b/libraries/networking/src/udt/Packet.cpp @@ -24,7 +24,7 @@ qint64 Packet::maxPayloadSize(PacketType::Value type) { std::unique_ptr Packet::create(PacketType::Value type, qint64 size) { auto packet = std::unique_ptr(new Packet(type, size)); - packet->open(QIODevice::WriteOnly); + packet->open(QIODevice::ReadWrite); return packet; } From 039ef0750cec00789db2bf4dda49e98ff53c2ee2 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 15 Jul 2015 18:52:59 -0700 Subject: [PATCH 3/3] set jurisdiction listener object name for thread identification --- libraries/networking/src/ReceivedPacketProcessor.cpp | 1 - libraries/octree/src/JurisdictionListener.cpp | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/networking/src/ReceivedPacketProcessor.cpp b/libraries/networking/src/ReceivedPacketProcessor.cpp index 15b46cdf8f..cc516bdbbd 100644 --- a/libraries/networking/src/ReceivedPacketProcessor.cpp +++ b/libraries/networking/src/ReceivedPacketProcessor.cpp @@ -39,7 +39,6 @@ bool ReceivedPacketProcessor::process() { quint64 now = usecTimestampNow(); quint64 sinceLastWindow = now - _lastWindowAt; - if (sinceLastWindow > USECS_PER_SECOND) { lock(); float secondsSinceLastWindow = sinceLastWindow / USECS_PER_SECOND; diff --git a/libraries/octree/src/JurisdictionListener.cpp b/libraries/octree/src/JurisdictionListener.cpp index 0fe67d046d..4979972c8a 100644 --- a/libraries/octree/src/JurisdictionListener.cpp +++ b/libraries/octree/src/JurisdictionListener.cpp @@ -20,6 +20,8 @@ JurisdictionListener::JurisdictionListener(NodeType_t type) : _nodeType(type), _packetSender(JurisdictionListener::DEFAULT_PACKETS_PER_SECOND) { + setObjectName("Jurisdiction Listener"); + connect(DependencyManager::get().data(), &NodeList::nodeKilled, this, &JurisdictionListener::nodeKilled); // tell our NodeList we want to hear about nodes with our node type @@ -34,7 +36,7 @@ void JurisdictionListener::nodeKilled(SharedNodePointer node) { bool JurisdictionListener::queueJurisdictionRequest() { auto packet = NLPacket::create(PacketType::JurisdictionRequest, 0); - + auto nodeList = DependencyManager::get(); int nodeCount = 0;