Update PacketSender to use NLPacket

This commit is contained in:
Ryan Huffman 2015-07-07 12:16:30 -07:00
parent ebd223ecba
commit 308335ff69
2 changed files with 6 additions and 6 deletions

View file

@ -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<NodeList>()->writeDatagram(temporary.getByteArray(), temporary.getNode());
DependencyManager::get<NodeList>()->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;
}

View file

@ -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; }