mirror of
https://github.com/lubosz/overte.git
synced 2025-05-05 23:27:40 +02:00
Merge branch 'atp' of github.com:birarda/hifi into protocol
This commit is contained in:
commit
9a3ba20f11
25 changed files with 151 additions and 84 deletions
|
@ -73,11 +73,6 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
|
|||
// put the NodeList on the node thread
|
||||
nodeList->moveToThread(nodeThread);
|
||||
|
||||
// make up a uuid for this child so the parent can tell us apart. This id will be changed
|
||||
// when the domain server hands over an assignment.
|
||||
QUuid nodeUUID = QUuid::createUuid();
|
||||
nodeList->setSessionUUID(nodeUUID);
|
||||
|
||||
// set the logging target to the the CHILD_TARGET_NAME
|
||||
LogHandler::getInstance().setTargetName(ASSIGNMENT_CLIENT_TARGET_NAME);
|
||||
|
||||
|
@ -197,7 +192,7 @@ void AssignmentClient::sendStatusPacketToACM() {
|
|||
|
||||
auto statusPacket = NLPacket::create(PacketType::AssignmentClientStatus, sizeof(assignmentType) + NUM_BYTES_RFC4122_UUID);
|
||||
|
||||
statusPacket->write(nodeList->getSessionUUID().toRfc4122());
|
||||
statusPacket->write(_childAssignmentUUID.toRfc4122());
|
||||
statusPacket->writePrimitive(assignmentType);
|
||||
|
||||
nodeList->sendPacket(std::move(statusPacket), _assignmentClientMonitorSocket);
|
||||
|
|
|
@ -51,6 +51,7 @@ private:
|
|||
HifiSockAddr _assignmentServerSocket;
|
||||
QTimer _requestTimer; // timer for requesting and assignment
|
||||
QTimer _statsTimerACM; // timer for sending stats to assignment client monitor
|
||||
QUuid _childAssignmentUUID = QUuid::createUuid();
|
||||
|
||||
protected:
|
||||
HifiSockAddr _assignmentClientMonitorSocket;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
/// Handles assignments of type AvatarMixer - distribution of avatar data to various clients
|
||||
class AvatarMixer : public ThreadedAssignment {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AvatarMixer(NLPacket& packet);
|
||||
~AvatarMixer();
|
||||
|
@ -26,7 +27,6 @@ public slots:
|
|||
/// runs the avatar mixer
|
||||
void run();
|
||||
|
||||
void nodeAdded(SharedNodePointer nodeAdded);
|
||||
void nodeKilled(SharedNodePointer killedNode);
|
||||
|
||||
void sendStatsPacket();
|
||||
|
|
|
@ -940,7 +940,7 @@ int DomainServer::parseNodeData(QDataStream& packetStream, NodeType_t& nodeType,
|
|||
const HifiSockAddr& senderSockAddr) {
|
||||
packetStream >> nodeType;
|
||||
packetStream >> publicSockAddr >> localSockAddr;
|
||||
|
||||
|
||||
if (publicSockAddr.getAddress().isNull()) {
|
||||
// this node wants to use us its STUN server
|
||||
// so set the node public address to whatever we perceive the public address to be
|
||||
|
|
|
@ -105,10 +105,10 @@ if (APPLE)
|
|||
# set where in the bundle to put the resources file
|
||||
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/icon/${ICON_FILENAME} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
|
||||
set(DISCOVERED_RESOURCES "")
|
||||
set(DISCOVERED_RESOURCES "")
|
||||
|
||||
# use the add_resources_to_os_x_bundle macro to recurse into resources
|
||||
add_resources_to_os_x_bundle("${CMAKE_CURRENT_SOURCE_DIR}/resources")
|
||||
add_resources_to_os_x_bundle("${CMAKE_CURRENT_SOURCE_DIR}/resources")
|
||||
|
||||
# append the discovered resources to our list of interface sources
|
||||
list(APPEND INTERFACE_SRCS ${DISCOVERED_RESOURCES})
|
||||
|
@ -136,12 +136,19 @@ target_include_directories(${TARGET_NAME} PRIVATE ${LIBOVR_INCLUDE_DIRS})
|
|||
target_link_libraries(${TARGET_NAME} ${LIBOVR_LIBRARIES})
|
||||
|
||||
find_package(Bullet REQUIRED)
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||
|
||||
# perform the system include hack for OS X to ignore warnings
|
||||
if (APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}")
|
||||
else()
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES})
|
||||
|
||||
# link required hifi libraries
|
||||
link_hifi_libraries(shared octree environment gpu model render fbx networking entities avatars
|
||||
audio audio-client animation script-engine physics
|
||||
link_hifi_libraries(shared octree environment gpu model render fbx networking entities avatars
|
||||
audio audio-client animation script-engine physics
|
||||
render-utils entities-renderer ui auto-updater)
|
||||
|
||||
add_dependency_external_projects(sdl2)
|
||||
|
@ -185,7 +192,7 @@ foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
|
|||
endforeach()
|
||||
|
||||
# special OS X modifications for RtMidi library
|
||||
if (RTMIDI_FOUND AND NOT DISABLE_RTMIDI AND APPLE)
|
||||
if (RTMIDI_FOUND AND NOT DISABLE_RTMIDI AND APPLE)
|
||||
find_library(CoreMIDI CoreMIDI)
|
||||
add_definitions(-D__MACOSX_CORE__)
|
||||
target_link_libraries(${TARGET_NAME} ${CoreMIDI})
|
||||
|
|
|
@ -135,9 +135,10 @@ class Application;
|
|||
|
||||
typedef bool (Application::* AcceptURLMethod)(const QString &);
|
||||
|
||||
class Application : public QApplication,
|
||||
class Application :
|
||||
public QApplication,
|
||||
public AbstractViewStateInterface,
|
||||
AbstractScriptingServicesInterface,
|
||||
public AbstractScriptingServicesInterface,
|
||||
public PacketListener {
|
||||
Q_OBJECT
|
||||
|
||||
|
|
|
@ -38,14 +38,14 @@
|
|||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdouble-promotion"
|
||||
#endif
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
|
|
@ -102,6 +102,10 @@ void AudioIOStats::sendDownstreamAudioStatsPacket() {
|
|||
_receivedAudioStream->perSecondCallbackForUpdatingStats();
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
if (!audioMixer) {
|
||||
return;
|
||||
}
|
||||
|
||||
quint8 appendFlag = 0;
|
||||
quint16 numStreamStatsToPack = 1;
|
||||
|
@ -118,8 +122,7 @@ void AudioIOStats::sendDownstreamAudioStatsPacket() {
|
|||
|
||||
// pack downstream audio stream stats
|
||||
statsPacket->writePrimitive(stats);
|
||||
|
||||
|
||||
// send packet
|
||||
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
nodeList->sendPacket(std::move(statsPacket), *audioMixer);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,14 @@ target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
|||
|
||||
add_dependency_external_projects(bullet)
|
||||
find_package(Bullet REQUIRED)
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||
|
||||
# perform the system include hack for OS X to ignore warnings
|
||||
if (APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}")
|
||||
else()
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES})
|
||||
|
||||
add_dependency_external_projects(polyvox)
|
||||
|
|
|
@ -10,7 +10,14 @@ target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
|||
add_dependency_external_projects(bullet)
|
||||
|
||||
find_package(Bullet REQUIRED)
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||
|
||||
# perform the system include hack for OS X to ignore warnings
|
||||
if (APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}")
|
||||
else()
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES})
|
||||
|
||||
link_hifi_libraries(avatars shared octree gpu model fbx networking animation environment)
|
||||
|
|
|
@ -180,6 +180,7 @@ bool LimitedNodeList::packetSourceAndHashMatch(const NLPacket& packet, SharedNod
|
|||
if (NON_SOURCED_PACKETS.contains(packet.getType())) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
// figure out which node this is from
|
||||
matchingNode = nodeWithUUID(packet.getSourceID());
|
||||
|
||||
|
@ -199,23 +200,35 @@ bool LimitedNodeList::packetSourceAndHashMatch(const NLPacket& packet, SharedNod
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
static QString repeatedMessage
|
||||
= LogHandler::getInstance().addRepeatedMessageRegex("Packet of type \\d+ received from unknown node with UUID");
|
||||
|
||||
qCDebug(networking) << "Packet of type" << packet.getType() << "received from unknown node with UUID"
|
||||
<< qPrintable(uuidStringWithoutCurlyBraces(packet.getSourceID()));
|
||||
qCDebug(networking) << "Packet of type" << packet.getType() << "(" << nameForPacketType(packet.getType()) << ")"
|
||||
<< "received from unknown node with UUID" << qPrintable(uuidStringWithoutCurlyBraces(packet.getSourceID()));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
qint64 LimitedNodeList::writeDatagram(const NLPacket& packet, const HifiSockAddr& destinationSockAddr) {
|
||||
return writeDatagram({packet.getData(), static_cast<int>(packet.getDataSize())}, destinationSockAddr);
|
||||
qint64 LimitedNodeList::writePacket(const NLPacket& packet, const HifiSockAddr& destinationSockAddr,
|
||||
const QUuid& connectionSecret) {
|
||||
if (!NON_SOURCED_PACKETS.contains(packet.getType())) {
|
||||
const_cast<NLPacket&>(packet).writeSourceID(getSessionUUID());
|
||||
}
|
||||
|
||||
if (!connectionSecret.isNull()
|
||||
&& !NON_SOURCED_PACKETS.contains(packet.getType())
|
||||
&& !NON_VERIFIED_PACKETS.contains(packet.getType())) {
|
||||
const_cast<NLPacket&>(packet).writeVerificationHash(packet.payloadHashWithConnectionUUID(connectionSecret));
|
||||
}
|
||||
|
||||
return writeDatagram(QByteArray::fromRawData(packet.getData(), packet.getDataSize()), destinationSockAddr);
|
||||
}
|
||||
|
||||
qint64 LimitedNodeList::writeDatagram(const QByteArray& datagram, const HifiSockAddr& destinationSockAddr) {
|
||||
|
@ -235,31 +248,35 @@ qint64 LimitedNodeList::writeDatagram(const QByteArray& datagram, const HifiSock
|
|||
}
|
||||
|
||||
qint64 LimitedNodeList::sendUnreliablePacket(const NLPacket& packet, const Node& destinationNode) {
|
||||
if (!destinationNode.getActiveSocket()) {
|
||||
const HifiSockAddr* activeSocket = destinationNode.getActiveSocket();
|
||||
if (!activeSocket) {
|
||||
// we don't have a socket to send to, return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
// use the node's active socket as the destination socket
|
||||
return sendUnreliablePacket(packet, *destinationNode.getActiveSocket());
|
||||
return sendUnreliablePacket(packet, *activeSocket, destinationNode.getConnectionSecret());
|
||||
}
|
||||
|
||||
qint64 LimitedNodeList::sendUnreliablePacket(const NLPacket& packet, const HifiSockAddr& sockAddr) {
|
||||
return writeDatagram(packet, sockAddr);
|
||||
qint64 LimitedNodeList::sendUnreliablePacket(const NLPacket& packet, const HifiSockAddr& sockAddr,
|
||||
const QUuid& connectionSecret) {
|
||||
return writePacket(packet, sockAddr, connectionSecret);
|
||||
}
|
||||
|
||||
qint64 LimitedNodeList::sendPacket(std::unique_ptr<NLPacket> packet, const Node& destinationNode) {
|
||||
if (!destinationNode.getActiveSocket()) {
|
||||
const HifiSockAddr* activeSocket = destinationNode.getActiveSocket();
|
||||
if (!activeSocket) {
|
||||
// we don't have a socket to send to, return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
// use the node's active socket as the destination socket
|
||||
return sendPacket(std::move(packet), *destinationNode.getActiveSocket());
|
||||
return sendPacket(std::move(packet), *activeSocket, destinationNode.getConnectionSecret());
|
||||
}
|
||||
|
||||
qint64 LimitedNodeList::sendPacket(std::unique_ptr<NLPacket> packet, const HifiSockAddr& sockAddr) {
|
||||
return writeDatagram(*packet, sockAddr);
|
||||
qint64 LimitedNodeList::sendPacket(std::unique_ptr<NLPacket> packet, const HifiSockAddr& sockAddr,
|
||||
const QUuid& connectionSecret) {
|
||||
return writePacket(*packet, sockAddr, connectionSecret);
|
||||
}
|
||||
|
||||
qint64 LimitedNodeList::sendPacketList(NLPacketList& packetList, const Node& destinationNode) {
|
||||
|
@ -268,17 +285,20 @@ qint64 LimitedNodeList::sendPacketList(NLPacketList& packetList, const Node& des
|
|||
// we don't have a socket to send to, return 0
|
||||
return 0;
|
||||
}
|
||||
return sendPacketList(packetList, *activeSocket);
|
||||
|
||||
// use the node's active socket as the destination socket
|
||||
return sendPacketList(packetList, *activeSocket, destinationNode.getConnectionSecret());
|
||||
}
|
||||
|
||||
qint64 LimitedNodeList::sendPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr) {
|
||||
qint64 bytesSent { 0 };
|
||||
qint64 LimitedNodeList::sendPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr,
|
||||
const QUuid& connectionSecret) {
|
||||
qint64 bytesSent = 0;
|
||||
|
||||
// close the last packet in the list
|
||||
packetList.closeCurrentPacket();
|
||||
|
||||
while (!packetList._packets.empty()) {
|
||||
bytesSent += sendPacket(std::move(packetList.takeFront<NLPacket>()), sockAddr);
|
||||
bytesSent += sendPacket(std::move(packetList.takeFront<NLPacket>()), sockAddr, connectionSecret);
|
||||
}
|
||||
|
||||
return bytesSent;
|
||||
|
@ -289,7 +309,7 @@ qint64 LimitedNodeList::sendPacket(std::unique_ptr<NLPacket> packet, const Node&
|
|||
// use the node's active socket as the destination socket if there is no overriden socket address
|
||||
auto& destinationSockAddr = (overridenSockAddr.isNull()) ? *destinationNode.getActiveSocket()
|
||||
: overridenSockAddr;
|
||||
return sendPacket(std::move(packet), destinationSockAddr);
|
||||
return sendPacket(std::move(packet), destinationSockAddr, destinationNode.getConnectionSecret());
|
||||
}
|
||||
|
||||
PacketSequenceNumber LimitedNodeList::getNextSequenceNumberForPacket(const QUuid& nodeUUID, PacketType::Value packetType) {
|
||||
|
@ -437,7 +457,7 @@ std::unique_ptr<NLPacket> LimitedNodeList::constructPingReplyPacket(NLPacket& pi
|
|||
|
||||
int packetSize = sizeof(PingType_t) + sizeof(quint64) + sizeof(quint64);
|
||||
|
||||
auto replyPacket = NLPacket::create(PacketType::Ping, packetSize);
|
||||
auto replyPacket = NLPacket::create(PacketType::PingReply, packetSize);
|
||||
|
||||
QDataStream packetStream(replyPacket.get());
|
||||
packetStream << typeFromOriginalPing << timeFromOriginalPing << usecTimestampNow();
|
||||
|
@ -477,7 +497,7 @@ unsigned int LimitedNodeList::broadcastToNodes(std::unique_ptr<NLPacket> packet,
|
|||
|
||||
eachNode([&](const SharedNodePointer& node){
|
||||
if (destinationNodeTypes.contains(node->getType())) {
|
||||
writeDatagram(*packet, *node->getActiveSocket());
|
||||
writePacket(*packet, *node->getActiveSocket(), node->getConnectionSecret());
|
||||
++n;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -120,13 +120,16 @@ public:
|
|||
PacketReceiver& getPacketReceiver() { return _packetReceiver; }
|
||||
|
||||
qint64 sendUnreliablePacket(const NLPacket& packet, const Node& destinationNode);
|
||||
qint64 sendUnreliablePacket(const NLPacket& packet, const HifiSockAddr& sockAddr);
|
||||
qint64 sendUnreliablePacket(const NLPacket& packet, const HifiSockAddr& sockAddr,
|
||||
const QUuid& connectionSecret = QUuid());
|
||||
|
||||
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const Node& destinationNode);
|
||||
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const HifiSockAddr& sockAddr);
|
||||
qint64 sendPacket(std::unique_ptr<NLPacket> packet, const HifiSockAddr& sockAddr,
|
||||
const QUuid& connectionSecret = QUuid());
|
||||
|
||||
qint64 sendPacketList(NLPacketList& packetList, const Node& destinationNode);
|
||||
qint64 sendPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr);
|
||||
qint64 sendPacketList(NLPacketList& packetList, const HifiSockAddr& sockAddr,
|
||||
const QUuid& connectionSecret = QUuid());
|
||||
|
||||
void (*linkedDataCreateCallback)(Node *);
|
||||
|
||||
|
@ -245,7 +248,8 @@ protected:
|
|||
LimitedNodeList(LimitedNodeList const&); // Don't implement, needed to avoid copies of singleton
|
||||
void operator=(LimitedNodeList const&); // Don't implement, needed to avoid copies of singleton
|
||||
|
||||
qint64 writeDatagram(const NLPacket& packet, const HifiSockAddr& destinationSockAddr);
|
||||
qint64 writePacket(const NLPacket& packet, const HifiSockAddr& destinationSockAddr,
|
||||
const QUuid& connectionSecret = QUuid());
|
||||
qint64 writeDatagram(const QByteArray& datagram, const HifiSockAddr& destinationSockAddr);
|
||||
|
||||
PacketSequenceNumber getNextSequenceNumberForPacket(const QUuid& nodeUUID, PacketType::Value packetType);
|
||||
|
|
|
@ -78,56 +78,62 @@ NLPacket::NLPacket(PacketType::Value type, qint64 size) :
|
|||
{
|
||||
Q_ASSERT(size >= 0);
|
||||
|
||||
qint64 headerSize = localHeaderSize(type);
|
||||
_payloadStart += headerSize;
|
||||
_payloadCapacity -= headerSize;
|
||||
adjustPayloadStartAndCapacity();
|
||||
}
|
||||
|
||||
NLPacket::NLPacket(PacketType::Value type) :
|
||||
Packet(type, -1)
|
||||
{
|
||||
qint64 headerSize = localHeaderSize(type);
|
||||
_payloadStart += headerSize;
|
||||
_payloadCapacity -= headerSize;
|
||||
adjustPayloadStartAndCapacity();
|
||||
}
|
||||
|
||||
NLPacket::NLPacket(const NLPacket& other) : Packet(other) {
|
||||
|
||||
}
|
||||
|
||||
NLPacket::NLPacket(std::unique_ptr<char> data, qint64 size, const HifiSockAddr& senderSockAddr) :
|
||||
Packet(std::move(data), size, senderSockAddr)
|
||||
{
|
||||
adjustPayloadStartAndCapacity();
|
||||
_payloadSize = _payloadCapacity;
|
||||
|
||||
readSourceID();
|
||||
readVerificationHash();
|
||||
}
|
||||
|
||||
void NLPacket::adjustPayloadStartAndCapacity() {
|
||||
qint64 headerSize = localHeaderSize(_type);
|
||||
_payloadStart += headerSize;
|
||||
_payloadCapacity -= headerSize;
|
||||
}
|
||||
|
||||
void NLPacket::readSourceID() {
|
||||
if (!NON_SOURCED_PACKETS.contains(_type)) {
|
||||
auto offset = Packet::totalHeadersSize();
|
||||
auto offset = Packet::localHeaderSize();
|
||||
_sourceID = QUuid::fromRfc4122(QByteArray::fromRawData(_packet.get() + offset, NUM_BYTES_RFC4122_UUID));
|
||||
}
|
||||
}
|
||||
|
||||
void NLPacket::readVerificationHash() {
|
||||
if (!NON_SOURCED_PACKETS.contains(_type) && !NON_VERIFIED_PACKETS.contains(_type)) {
|
||||
auto offset = Packet::totalHeadersSize() + NUM_BYTES_RFC4122_UUID;
|
||||
auto offset = Packet::localHeaderSize() + NUM_BYTES_RFC4122_UUID;
|
||||
_verificationHash = QByteArray(_packet.get() + offset, NUM_BYTES_MD5_HASH);
|
||||
}
|
||||
}
|
||||
|
||||
void NLPacket::setSourceID(const QUuid& sourceID) {
|
||||
void NLPacket::writeSourceID(const QUuid& sourceID) {
|
||||
Q_ASSERT(!NON_SOURCED_PACKETS.contains(_type));
|
||||
|
||||
auto offset = Packet::totalHeadersSize();
|
||||
auto offset = Packet::localHeaderSize();
|
||||
memcpy(_packet.get() + offset, sourceID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID);
|
||||
|
||||
_sourceID = sourceID;
|
||||
}
|
||||
|
||||
void NLPacket::setVerificationHash(const QByteArray& verificationHash) {
|
||||
void NLPacket::writeVerificationHash(const QByteArray& verificationHash) {
|
||||
Q_ASSERT(!NON_SOURCED_PACKETS.contains(_type) && !NON_VERIFIED_PACKETS.contains(_type));
|
||||
|
||||
auto offset = Packet::totalHeadersSize() + NUM_BYTES_RFC4122_UUID;
|
||||
auto offset = Packet::localHeaderSize() + NUM_BYTES_RFC4122_UUID;
|
||||
memcpy(_packet.get() + offset, verificationHash.data(), verificationHash.size());
|
||||
|
||||
_verificationHash = verificationHash;
|
||||
|
|
|
@ -33,20 +33,23 @@ public:
|
|||
|
||||
const QUuid& getSourceID() const { return _sourceID; }
|
||||
const QByteArray& getVerificationHash() const { return _verificationHash; }
|
||||
|
||||
void writeSourceID(const QUuid& sourceID);
|
||||
void writeVerificationHash(const QByteArray& verificationHash);
|
||||
|
||||
QByteArray payloadHashWithConnectionUUID(const QUuid& connectionUUID) const;
|
||||
|
||||
protected:
|
||||
|
||||
void adjustPayloadStartAndCapacity();
|
||||
|
||||
NLPacket(PacketType::Value type);
|
||||
NLPacket(PacketType::Value type, qint64 size);
|
||||
NLPacket(std::unique_ptr<char> data, qint64 size, const HifiSockAddr& senderSockAddr);
|
||||
NLPacket(const NLPacket& other);
|
||||
|
||||
void readSourceID();
|
||||
void setSourceID(const QUuid& sourceID);
|
||||
|
||||
void readVerificationHash();
|
||||
void setVerificationHash(const QByteArray& verificationHash);
|
||||
|
||||
QUuid _sourceID;
|
||||
QByteArray _verificationHash;
|
||||
|
|
|
@ -93,6 +93,7 @@ NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned
|
|||
packetReceiver.registerListener(PacketType::Ping, this, "processPingPacket");
|
||||
packetReceiver.registerListener(PacketType::PingReply, this, "processPingReplyPacket");
|
||||
packetReceiver.registerListener(PacketType::ICEPing, this, "processICEPingPacket");
|
||||
packetReceiver.registerListener(PacketType::DomainServerAddedNode, this, "processDomainServerAddedNode");
|
||||
|
||||
packetReceiver.registerListener(PacketType::ICEServerPeerInformation, &_domainHandler, "processICEResponsePacket");
|
||||
packetReceiver.registerListener(PacketType::DomainServerRequireDTLS, &_domainHandler, "processDTLSRequirementPacket");
|
||||
|
@ -159,6 +160,7 @@ void NodeList::timePingReply(QSharedPointer<NLPacket> packet, const SharedNodePo
|
|||
}
|
||||
|
||||
void NodeList::processPingPacket(QSharedPointer<NLPacket> packet, SharedNodePointer sendingNode) {
|
||||
|
||||
// send back a reply
|
||||
auto replyPacket = constructPingReplyPacket(*packet);
|
||||
const HifiSockAddr& senderSockAddr = packet->getSenderSockAddr();
|
||||
|
@ -284,7 +286,7 @@ void NodeList::sendDomainServerCheckIn() {
|
|||
|
||||
flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::SendDSCheckIn);
|
||||
|
||||
if (!isUsingDTLS) {
|
||||
if (!isUsingDTLS) {
|
||||
sendPacket(std::move(domainPacket), _domainHandler.getSockAddr());
|
||||
}
|
||||
|
||||
|
|
|
@ -14,5 +14,8 @@
|
|||
#include "NodeList.h"
|
||||
|
||||
PacketListener::~PacketListener() {
|
||||
DependencyManager::get<LimitedNodeList>()->getPacketReceiver().unregisterListener(this);
|
||||
auto limitedNodelist = DependencyManager::get<LimitedNodeList>();
|
||||
if (limitedNodelist) {
|
||||
limitedNodelist->getPacketReceiver().unregisterListener(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,15 +269,12 @@ void PacketReceiver::processDatagrams() {
|
|||
<< listener.first << "::" << qPrintable(listener.second.methodSignature());
|
||||
}
|
||||
|
||||
} else {
|
||||
// we have a dead listener - remove this mapping from the _packetListenerMap
|
||||
qDebug() << "Listener for packet type" << packet->getType() << "("
|
||||
<< qPrintable(nameForPacketType(packet->getType())) << ")"
|
||||
<< "has been destroyed - removing mapping.";
|
||||
_packetListenerMap.erase(it);
|
||||
}
|
||||
} else {
|
||||
qDebug() << "No listener found for packet type " << nameForPacketType(packet->getType());
|
||||
qWarning() << "No listener found for packet type " << nameForPacketType(packet->getType());
|
||||
|
||||
// insert a dummy listener so we don't print this again
|
||||
_packetListenerMap.insert(packet->getType(), { nullptr, QMetaMethod() });
|
||||
}
|
||||
|
||||
_packetListenerLock.unlock();
|
||||
|
|
|
@ -139,7 +139,7 @@ Packet& Packet::operator=(Packet&& other) {
|
|||
|
||||
void Packet::setPayloadSize(qint64 payloadSize) {
|
||||
if (isWritable()) {
|
||||
Q_ASSERT(payloadSize > _payloadCapacity);
|
||||
Q_ASSERT(payloadSize <= _payloadCapacity);
|
||||
_payloadSize = std::max(payloadSize, _payloadCapacity);
|
||||
} else {
|
||||
qDebug() << "You can not call setPayloadSize for a non-writeable Packet.";
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
PacketVersion getVersion() const { return _version; }
|
||||
|
||||
// Returns the size of the packet, including the header
|
||||
qint64 getDataSize() const { return totalHeadersSize() + getPayloadSize(); }
|
||||
qint64 getDataSize() const { return totalHeadersSize() + _payloadSize; }
|
||||
|
||||
// Returns the size of the payload only
|
||||
qint64 getPayloadSize() const { return _payloadSize; }
|
||||
|
|
|
@ -20,9 +20,7 @@ using namespace PacketType;
|
|||
const QSet<PacketType::Value> NON_VERIFIED_PACKETS = QSet<PacketType::Value>()
|
||||
<< NodeJsonStats << EntityQuery
|
||||
<< OctreeDataNack << EntityEditNack
|
||||
<< DomainListRequest
|
||||
<< Ping
|
||||
<< PingReply << StopNode;
|
||||
<< DomainListRequest << StopNode;
|
||||
|
||||
const QSet<PacketType::Value> SEQUENCE_NUMBERED_PACKETS = QSet<PacketType::Value>() << AvatarData;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ PacketList::PacketList(PacketType::Value packetType) :
|
|||
}
|
||||
|
||||
void PacketList::startSegment() {
|
||||
_segmentStartIndex = _currentPacket->pos();
|
||||
_segmentStartIndex = _currentPacket ? _currentPacket->pos() : 0;
|
||||
}
|
||||
|
||||
void PacketList::endSegment() {
|
||||
|
|
|
@ -10,7 +10,14 @@ target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
|||
add_dependency_external_projects(bullet)
|
||||
|
||||
find_package(Bullet REQUIRED)
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||
|
||||
# perform the system include hack for OS X to ignore warnings
|
||||
if (APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}")
|
||||
else()
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES})
|
||||
|
||||
link_hifi_libraries(shared fbx entities)
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <QBuffer>
|
||||
#include <QFile>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdouble-promotion"
|
||||
#endif
|
||||
|
@ -29,7 +29,7 @@
|
|||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ void testPropertyFlags(uint32_t value) {
|
|||
}
|
||||
QByteArray encoded = original.encode();
|
||||
#ifndef QT_NO_DEBUG
|
||||
auto originalSize = encoded.size();
|
||||
int originalSize = encoded.size();
|
||||
#endif
|
||||
for (size_t i = 0; i < enumSize; ++i) {
|
||||
encoded.append(qrand());
|
||||
|
@ -123,7 +123,7 @@ void testPropertyFlags(uint32_t value) {
|
|||
|
||||
{
|
||||
#ifndef QT_NO_DEBUG
|
||||
auto decodeSize = decodeNew.decode((const uint8_t*)encoded.data(), encoded.size());
|
||||
int decodeSize = decodeNew.decode((const uint8_t*)encoded.data(), encoded.size());
|
||||
#endif
|
||||
Q_ASSERT(originalSize == decodeSize);
|
||||
Q_ASSERT(decodeNew == original);
|
||||
|
|
|
@ -8,11 +8,17 @@ macro (SETUP_TESTCASE_DEPENDENCIES)
|
|||
add_dependency_external_projects(bullet)
|
||||
|
||||
find_package(Bullet REQUIRED)
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES})
|
||||
|
||||
# perform the system include hack for OS X to ignore warnings
|
||||
if (APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}")
|
||||
else()
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
link_hifi_libraries(shared physics)
|
||||
copy_dlls_beside_windows_executable()
|
||||
endmacro ()
|
||||
|
||||
setup_hifi_testcase(Script)
|
||||
setup_hifi_testcase(Script)
|
||||
|
|
Loading…
Reference in a new issue