Update JurisdictionListener to use NLPacket

This commit is contained in:
Ryan Huffman 2015-07-07 12:09:54 -07:00
parent e1c098233a
commit 18dd61ec7e

View file

@ -33,17 +33,15 @@ void JurisdictionListener::nodeKilled(SharedNodePointer node) {
} }
bool JurisdictionListener::queueJurisdictionRequest() { bool JurisdictionListener::queueJurisdictionRequest() {
static unsigned char buffer[MAX_PACKET_SIZE]; auto packet = NLPacket::create(PacketType::JurisdictionRequest, 0);
unsigned char* bufferOut = &buffer[0];
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
int sizeOut = nodeList->populatePacketHeader(reinterpret_cast<char*>(bufferOut), PacketTypeJurisdictionRequest);
int nodeCount = 0; int nodeCount = 0;
nodeList->eachNode([&](const SharedNodePointer& node) { nodeList->eachNode([&](const SharedNodePointer& node) {
if (node->getType() == getNodeType() && node->getActiveSocket()) { if (node->getType() == getNodeType() && node->getActiveSocket()) {
_packetSender.queuePacketForSending(node, QByteArray(reinterpret_cast<char*>(bufferOut), sizeOut)); _packetSender.queuePacketForSending(node, packet);
nodeCount++; nodeCount++;
} }
}); });