mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 02:27:48 +02:00
delete the old methods to get closer to an even PR
This commit is contained in:
parent
01d1a17231
commit
bcea400ee4
2 changed files with 7 additions and 150 deletions
|
@ -248,107 +248,6 @@ qint64 LimitedNodeList::writeDatagram(const QByteArray& datagram, const HifiSock
|
||||||
return bytesWritten;
|
return bytesWritten;
|
||||||
}
|
}
|
||||||
|
|
||||||
//qint64 LimitedNodeList::writeDatagram(const QByteArray& datagram,
|
|
||||||
// const SharedNodePointer& destinationNode,
|
|
||||||
// const HifiSockAddr& overridenSockAddr) {
|
|
||||||
// if (destinationNode) {
|
|
||||||
// PacketType::Value packetType = packetTypeForPacket(datagram);
|
|
||||||
//
|
|
||||||
// if (NON_VERIFIED_PACKETS.contains(packetType)) {
|
|
||||||
// return writeUnverifiedDatagram(datagram, destinationNode, overridenSockAddr);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // if we don't have an overridden address, assume they want to send to the node's active socket
|
|
||||||
// const HifiSockAddr* destinationSockAddr = &overridenSockAddr;
|
|
||||||
// if (overridenSockAddr.isNull()) {
|
|
||||||
// if (destinationNode->getActiveSocket()) {
|
|
||||||
// // use the node's active socket as the destination socket
|
|
||||||
// destinationSockAddr = destinationNode->getActiveSocket();
|
|
||||||
// } else {
|
|
||||||
// // we don't have a socket to send to, return 0
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// QByteArray datagramCopy = datagram;
|
|
||||||
//
|
|
||||||
// // if we're here and the connection secret is null, debug out - this could be a problem
|
|
||||||
// if (destinationNode->getConnectionSecret().isNull()) {
|
|
||||||
// qDebug() << "LimitedNodeList::writeDatagram called for verified datagram with null connection secret for"
|
|
||||||
// << "destination node" << destinationNode->getUUID() << " - this is either not secure or will cause"
|
|
||||||
// << "this packet to be unverifiable on the receiving side.";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // perform replacement of hash and optionally also sequence number in the header
|
|
||||||
// if (SEQUENCE_NUMBERED_PACKETS.contains(packetType)) {
|
|
||||||
// PacketSequenceNumber sequenceNumber = getNextSequenceNumberForPacket(destinationNode->getUUID(), packetType);
|
|
||||||
// replaceHashAndSequenceNumberInPacket(datagramCopy, destinationNode->getConnectionSecret(),
|
|
||||||
// sequenceNumber, packetType);
|
|
||||||
// } else {
|
|
||||||
// replaceHashInPacket(datagramCopy, destinationNode->getConnectionSecret(), packetType);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// emit dataSent(destinationNode->getType(), datagram.size());
|
|
||||||
// auto bytesWritten = writeDatagram(datagramCopy, *destinationSockAddr);
|
|
||||||
// // Keep track of per-destination-node bandwidth
|
|
||||||
// destinationNode->recordBytesSent(bytesWritten);
|
|
||||||
// return bytesWritten;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // didn't have a destinationNode to send to, return 0
|
|
||||||
// return 0;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//qint64 LimitedNodeList::writeUnverifiedDatagram(const QByteArray& datagram, const SharedNodePointer& destinationNode,
|
|
||||||
// const HifiSockAddr& overridenSockAddr) {
|
|
||||||
// if (destinationNode) {
|
|
||||||
// // if we don't have an ovveriden address, assume they want to send to the node's active socket
|
|
||||||
// const HifiSockAddr* destinationSockAddr = &overridenSockAddr;
|
|
||||||
// if (overridenSockAddr.isNull()) {
|
|
||||||
// if (destinationNode->getActiveSocket()) {
|
|
||||||
// // use the node's active socket as the destination socket
|
|
||||||
// destinationSockAddr = destinationNode->getActiveSocket();
|
|
||||||
// } else {
|
|
||||||
// // we don't have a socket to send to, return 0
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// PacketType::Value packetType = packetTypeForPacket(datagram);
|
|
||||||
//
|
|
||||||
// // optionally peform sequence number replacement in the header
|
|
||||||
// if (SEQUENCE_NUMBERED_PACKETS.contains(packetType)) {
|
|
||||||
//
|
|
||||||
// QByteArray datagramCopy = datagram;
|
|
||||||
//
|
|
||||||
// PacketSequenceNumber sequenceNumber = getNextSequenceNumberForPacket(destinationNode->getUUID(), packetType);
|
|
||||||
// replaceSequenceNumberInPacket(datagramCopy, sequenceNumber, packetType);
|
|
||||||
//
|
|
||||||
// // send the datagram with sequence number replaced in header
|
|
||||||
// return writeDatagram(datagramCopy, *destinationSockAddr);
|
|
||||||
// } else {
|
|
||||||
// return writeDatagram(datagram, *destinationSockAddr);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // didn't have a destinationNode to send to, return 0
|
|
||||||
// return 0;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//qint64 LimitedNodeList::writeUnverifiedDatagram(const QByteArray& datagram, const HifiSockAddr& destinationSockAddr) {
|
|
||||||
// return writeDatagram(datagram, destinationSockAddr);
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//qint64 LimitedNodeList::writeDatagram(const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
|
||||||
// const HifiSockAddr& overridenSockAddr) {
|
|
||||||
// return writeDatagram(QByteArray(data, size), destinationNode, overridenSockAddr);
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//qint64 LimitedNodeList::writeUnverifiedDatagram(const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
|
||||||
// const HifiSockAddr& overridenSockAddr) {
|
|
||||||
// return writeUnverifiedDatagram(QByteArray(data, size), destinationNode, overridenSockAddr);
|
|
||||||
//}
|
|
||||||
|
|
||||||
PacketSequenceNumber LimitedNodeList::getNextSequenceNumberForPacket(const QUuid& nodeUUID, PacketType::Value packetType) {
|
PacketSequenceNumber LimitedNodeList::getNextSequenceNumberForPacket(const QUuid& nodeUUID, PacketType::Value packetType) {
|
||||||
// Thanks to std::map and std::unordered_map this line either default constructs the
|
// Thanks to std::map and std::unordered_map this line either default constructs the
|
||||||
// PacketType::SequenceMap and the PacketSequenceNumber or returns the existing value.
|
// PacketType::SequenceMap and the PacketSequenceNumber or returns the existing value.
|
||||||
|
@ -506,19 +405,6 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// unsigned LimitedNodeList::broadcastToNodes(PacketList& packetList, const NodeSet& destinationNodeTypes) {
|
|
||||||
// unsigned n = 0;
|
|
||||||
//
|
|
||||||
// eachNode([&](const SharedNodePointer& node){
|
|
||||||
// if (destinationNodeTypes.contains(node->getType())) {
|
|
||||||
// writeDatagram(packet, node);
|
|
||||||
// ++n;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// return n;
|
|
||||||
// }
|
|
||||||
|
|
||||||
std::unique_ptr<NLPacket> LimitedNodeList::constructPingPacket(PingType_t pingType) {
|
std::unique_ptr<NLPacket> LimitedNodeList::constructPingPacket(PingType_t pingType) {
|
||||||
int packetSize = sizeof(PingType_t) + sizeof(quint64);
|
int packetSize = sizeof(PingType_t) + sizeof(quint64);
|
||||||
auto pingPacket = NLPacket::create(PacketType::Ping, packetSize);
|
auto pingPacket = NLPacket::create(PacketType::Ping, packetSize);
|
||||||
|
|
|
@ -121,44 +121,16 @@ public:
|
||||||
|
|
||||||
bool packetVersionAndHashMatch(const QByteArray& packet);
|
bool packetVersionAndHashMatch(const QByteArray& packet);
|
||||||
|
|
||||||
// QByteArray byteArrayWithPopulatedHeader(PacketType::Value packetType)
|
|
||||||
// { return byteArrayWithUUIDPopulatedHeader(packetType, _sessionUUID); }
|
|
||||||
// int populatePacketHeader(QByteArray& packet, PacketType::Value packetType)
|
|
||||||
// { return populatePacketHeaderWithUUID(packet, packetType, _sessionUUID); }
|
|
||||||
// int populatePacketHeader(char* packet, PacketType::Value packetType)
|
|
||||||
// { return populatePacketHeaderWithUUID(packet, packetType, _sessionUUID); }
|
|
||||||
|
|
||||||
qint64 readDatagram(QByteArray& incomingPacket, QHostAddress* address, quint16 * port);
|
qint64 readDatagram(QByteArray& incomingPacket, QHostAddress* address, quint16 * port);
|
||||||
//
|
|
||||||
// qint64 writeDatagram(const QByteArray& datagram, const SharedNodePointer& destinationNode,
|
|
||||||
// const HifiSockAddr& overridenSockAddr = HifiSockAddr());
|
|
||||||
//
|
|
||||||
// qint64 writeUnverifiedDatagram(const QByteArray& datagram, const SharedNodePointer& destinationNode,
|
|
||||||
// const HifiSockAddr& overridenSockAddr = HifiSockAddr());
|
|
||||||
//
|
|
||||||
// qint64 writeUnverifiedDatagram(const QByteArray& datagram, const HifiSockAddr& destinationSockAddr);
|
|
||||||
//
|
|
||||||
// qint64 writeDatagram(const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
|
||||||
// const HifiSockAddr& overridenSockAddr = HifiSockAddr());
|
|
||||||
//
|
|
||||||
// qint64 writeUnverifiedDatagram(const char* data, qint64 size, const SharedNodePointer& destinationNode,
|
|
||||||
// const HifiSockAddr& overridenSockAddr = HifiSockAddr());
|
|
||||||
//
|
|
||||||
|
|
||||||
qint64 sendUnreliablePacket(const NLPacket& packet, const SharedNodePointer& destinationNode)
|
qint64 sendUnreliablePacket(const NLPacket& packet, const SharedNodePointer& destinationNode) { assert(false); return 0; }
|
||||||
{ assert(false); return 0; }
|
qint64 sendUnreliablePacket(const NLPacket& packet, const HifiSockAddr& sockAddr) { assert(false); return 0; }
|
||||||
qint64 sendUnreliablePacket(const NLPacket& packet, const HifiSockAddr& sockAddr)
|
|
||||||
{ assert(false); return 0; }
|
|
||||||
|
|
||||||
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const SharedNodePointer& destinationNode)
|
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const SharedNodePointer& destinationNode) { assert(false); return 0; }
|
||||||
{ assert(false); return 0; }
|
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const HifiSockAddr& sockAddr) { assert(false); return 0; }
|
||||||
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const HifiSockAddr& sockAddr)
|
|
||||||
{ assert(false); return 0; }
|
|
||||||
|
|
||||||
qint64 sendPacketList(NLPacketList& packetList, const SharedNodePointer& destinationNode)
|
qint64 sendPacketList(NLPacketList& packetList, const SharedNodePointer& destinationNode) { assert(false); return 0; }
|
||||||
{ assert(false); return 0; }
|
qint64 sendPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr) { assert(false); return 0; }
|
||||||
qint64 sendPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr)
|
|
||||||
{ assert(false); return 0; }
|
|
||||||
|
|
||||||
void (*linkedDataCreateCallback)(Node *);
|
void (*linkedDataCreateCallback)(Node *);
|
||||||
|
|
||||||
|
@ -183,8 +155,7 @@ public:
|
||||||
int updateNodeWithDataFromPacket(const SharedNodePointer& matchingNode, const QByteArray& packet);
|
int updateNodeWithDataFromPacket(const SharedNodePointer& matchingNode, const QByteArray& packet);
|
||||||
int findNodeAndUpdateWithDataFromPacket(const QByteArray& packet);
|
int findNodeAndUpdateWithDataFromPacket(const QByteArray& packet);
|
||||||
|
|
||||||
unsigned broadcastToNodes(std::unique_ptr<NLPacket> packet, const NodeSet& destinationNodeTypes)
|
unsigned broadcastToNodes(std::unique_ptr<NLPacket> packet, const NodeSet& destinationNodeTypes) { assert(false); return 0; }
|
||||||
{ assert(false); return 0; }
|
|
||||||
SharedNodePointer soloNodeOfType(char nodeType);
|
SharedNodePointer soloNodeOfType(char nodeType);
|
||||||
|
|
||||||
void getPacketStats(float &packetsPerSecond, float &bytesPerSecond);
|
void getPacketStats(float &packetsPerSecond, float &bytesPerSecond);
|
||||||
|
|
Loading…
Reference in a new issue