mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 06:23:35 +02:00
Update PacketSender to use NLPacket
This commit is contained in:
parent
ebd223ecba
commit
308335ff69
2 changed files with 6 additions and 6 deletions
|
@ -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);
|
NetworkPacket networkPacket(destinationNode, packet);
|
||||||
lock();
|
lock();
|
||||||
_packets.push_back(networkPacket);
|
_packets.push_back(networkPacket);
|
||||||
unlock();
|
unlock();
|
||||||
_totalPacketsQueued++;
|
_totalPacketsQueued++;
|
||||||
_totalBytesQueued += packet.size();
|
_totalBytesQueued += packet.getSizeWithHeader();
|
||||||
|
|
||||||
// Make sure to wake our actual processing thread because we now have packets for it to process.
|
// Make sure to wake our actual processing thread because we now have packets for it to process.
|
||||||
_hasPackets.wakeAll();
|
_hasPackets.wakeAll();
|
||||||
|
@ -271,13 +271,13 @@ bool PacketSender::nonThreadedProcess() {
|
||||||
unlock();
|
unlock();
|
||||||
|
|
||||||
// send the packet through the NodeList...
|
// send the packet through the NodeList...
|
||||||
DependencyManager::get<NodeList>()->writeDatagram(temporary.getByteArray(), temporary.getNode());
|
DependencyManager::get<NodeList>()->sendUnreliablePacket(temporary.getPacket(), temporary.getNode());
|
||||||
packetsSentThisCall++;
|
packetsSentThisCall++;
|
||||||
_packetsOverCheckInterval++;
|
_packetsOverCheckInterval++;
|
||||||
_totalPacketsSent++;
|
_totalPacketsSent++;
|
||||||
_totalBytesSent += temporary.getByteArray().size();
|
_totalBytesSent += temporary.getPacket().getSizeWithHeader();
|
||||||
|
|
||||||
emit packetSent(temporary.getByteArray().size());
|
emit packetSent(temporary.getPacket().getSizeWithHeader());
|
||||||
|
|
||||||
_lastSendTime = now;
|
_lastSendTime = now;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
~PacketSender();
|
~PacketSender();
|
||||||
|
|
||||||
/// Add packet to outbound queue.
|
/// 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);
|
void setPacketsPerSecond(int packetsPerSecond);
|
||||||
int getPacketsPerSecond() const { return _packetsPerSecond; }
|
int getPacketsPerSecond() const { return _packetsPerSecond; }
|
||||||
|
|
Loading…
Reference in a new issue