From 308335ff69fc10880a5993229d81ea9042ee293d Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 7 Jul 2015 12:16:30 -0700 Subject: [PATCH] Update PacketSender to use NLPacket --- libraries/networking/src/PacketSender.cpp | 10 +++++----- libraries/networking/src/PacketSender.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/networking/src/PacketSender.cpp b/libraries/networking/src/PacketSender.cpp index f560d94b86..4481cd716c 100644 --- a/libraries/networking/src/PacketSender.cpp +++ b/libraries/networking/src/PacketSender.cpp @@ -48,13 +48,13 @@ PacketSender::~PacketSender() { } -void PacketSender::queuePacketForSending(const SharedNodePointer& destinationNode, const QByteArray& packet) { +void PacketSender::queuePacketForSending(const SharedNodePointer& destinationNode, const NLPacket& packet) { NetworkPacket networkPacket(destinationNode, packet); lock(); _packets.push_back(networkPacket); unlock(); _totalPacketsQueued++; - _totalBytesQueued += packet.size(); + _totalBytesQueued += packet.getSizeWithHeader(); // Make sure to wake our actual processing thread because we now have packets for it to process. _hasPackets.wakeAll(); @@ -271,13 +271,13 @@ bool PacketSender::nonThreadedProcess() { unlock(); // send the packet through the NodeList... - DependencyManager::get()->writeDatagram(temporary.getByteArray(), temporary.getNode()); + DependencyManager::get()->sendUnreliablePacket(temporary.getPacket(), temporary.getNode()); packetsSentThisCall++; _packetsOverCheckInterval++; _totalPacketsSent++; - _totalBytesSent += temporary.getByteArray().size(); + _totalBytesSent += temporary.getPacket().getSizeWithHeader(); - emit packetSent(temporary.getByteArray().size()); + emit packetSent(temporary.getPacket().getSizeWithHeader()); _lastSendTime = now; } diff --git a/libraries/networking/src/PacketSender.h b/libraries/networking/src/PacketSender.h index 29d9287127..6754da9825 100644 --- a/libraries/networking/src/PacketSender.h +++ b/libraries/networking/src/PacketSender.h @@ -39,7 +39,7 @@ public: ~PacketSender(); /// Add packet to outbound queue. - void queuePacketForSending(const SharedNodePointer& destinationNode, const QByteArray& packet); + void queuePacketForSending(const SharedNodePointer& destinationNode, const NLPacket& packet); void setPacketsPerSecond(int packetsPerSecond); int getPacketsPerSecond() const { return _packetsPerSecond; }