mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Add sendPacketList that take Node
This commit is contained in:
parent
9b174bfbf4
commit
24faab2089
2 changed files with 15 additions and 0 deletions
|
@ -32,6 +32,7 @@
|
|||
#include "HifiSockAddr.h"
|
||||
#include "UUID.h"
|
||||
#include "NetworkLogging.h"
|
||||
#include "udt/Packet.h"
|
||||
|
||||
const char SOLO_NODE_TYPES[2] = {
|
||||
NodeType::AvatarMixer,
|
||||
|
@ -344,6 +345,19 @@ qint64 LimitedNodeList::sendPacketList(std::unique_ptr<NLPacketList> packetList,
|
|||
return _nodeSocket.writePacketList(std::move(packetList), sockAddr);
|
||||
}
|
||||
|
||||
qint64 LimitedNodeList::sendPacketList(std::unique_ptr<NLPacketList> packetList, const Node& destinationNode) {
|
||||
// close the last packet in the list
|
||||
packetList->closeCurrentPacket();
|
||||
|
||||
for (std::unique_ptr<udt::Packet>& packet : packetList->_packets) {
|
||||
NLPacket* nlPacket = static_cast<NLPacket*>(packet.get());
|
||||
collectPacketStats(*nlPacket);
|
||||
fillPacketHeader(*nlPacket, destinationNode.getConnectionSecret());
|
||||
}
|
||||
|
||||
return _nodeSocket.writePacketList(std::move(packetList), *destinationNode.getActiveSocket());
|
||||
}
|
||||
|
||||
qint64 LimitedNodeList::sendPacket(std::unique_ptr<NLPacket> packet, const Node& destinationNode,
|
||||
const HifiSockAddr& overridenSockAddr) {
|
||||
// use the node's active socket as the destination socket if there is no overriden socket address
|
||||
|
|
|
@ -128,6 +128,7 @@ public:
|
|||
qint64 sendPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr,
|
||||
const QUuid& connectionSecret = QUuid());
|
||||
qint64 sendPacketList(std::unique_ptr<NLPacketList> packetList, const HifiSockAddr& sockAddr);
|
||||
qint64 sendPacketList(std::unique_ptr<NLPacketList> packetList, const Node& destinationNode);
|
||||
|
||||
void (*linkedDataCreateCallback)(Node *);
|
||||
|
||||
|
|
Loading…
Reference in a new issue