diff --git a/libraries/octree/src/JurisdictionListener.cpp b/libraries/octree/src/JurisdictionListener.cpp index 71c4feda96..a86130b005 100644 --- a/libraries/octree/src/JurisdictionListener.cpp +++ b/libraries/octree/src/JurisdictionListener.cpp @@ -33,17 +33,15 @@ void JurisdictionListener::nodeKilled(SharedNodePointer node) { } bool JurisdictionListener::queueJurisdictionRequest() { - static unsigned char buffer[MAX_PACKET_SIZE]; - unsigned char* bufferOut = &buffer[0]; + auto packet = NLPacket::create(PacketType::JurisdictionRequest, 0); auto nodeList = DependencyManager::get(); - int sizeOut = nodeList->populatePacketHeader(reinterpret_cast(bufferOut), PacketTypeJurisdictionRequest); int nodeCount = 0; nodeList->eachNode([&](const SharedNodePointer& node) { if (node->getType() == getNodeType() && node->getActiveSocket()) { - _packetSender.queuePacketForSending(node, QByteArray(reinterpret_cast(bufferOut), sizeOut)); + _packetSender.queuePacketForSending(node, packet); nodeCount++; } });