mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 17:50:42 +02:00
handle domain server node removal in NodeList
This commit is contained in:
parent
e52e9be44c
commit
6b2987eef8
3 changed files with 18 additions and 1 deletions
|
@ -804,8 +804,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
|
|
||||||
void Application::aboutToQuit() {
|
void Application::aboutToQuit() {
|
||||||
emit beforeAboutToQuit();
|
emit beforeAboutToQuit();
|
||||||
|
|
||||||
getActiveDisplayPlugin()->deactivate();
|
getActiveDisplayPlugin()->deactivate();
|
||||||
|
|
||||||
_aboutToQuit = true;
|
_aboutToQuit = true;
|
||||||
|
|
||||||
cleanupBeforeQuit();
|
cleanupBeforeQuit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -831,8 +834,13 @@ void Application::cleanupBeforeQuit() {
|
||||||
|
|
||||||
_entities.clear(); // this will allow entity scripts to properly shutdown
|
_entities.clear(); // this will allow entity scripts to properly shutdown
|
||||||
|
|
||||||
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
|
||||||
|
// send the domain a disconnect packet
|
||||||
|
nodeList->getDomainHandler().disconnect();
|
||||||
|
|
||||||
// tell the packet receiver we're shutting down, so it can drop packets
|
// tell the packet receiver we're shutting down, so it can drop packets
|
||||||
DependencyManager::get<NodeList>()->getPacketReceiver().setShouldDropPackets(true);
|
nodeList->getPacketReceiver().setShouldDropPackets(true);
|
||||||
|
|
||||||
_entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
|
_entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
|
||||||
ScriptEngine::stopAllScripts(this); // stop all currently running global scripts
|
ScriptEngine::stopAllScripts(this); // stop all currently running global scripts
|
||||||
|
|
|
@ -103,6 +103,7 @@ NodeList::NodeList(char newOwnerType, unsigned short socketListenPort, unsigned
|
||||||
packetReceiver.registerListener(PacketType::DomainServerRequireDTLS, &_domainHandler, "processDTLSRequirementPacket");
|
packetReceiver.registerListener(PacketType::DomainServerRequireDTLS, &_domainHandler, "processDTLSRequirementPacket");
|
||||||
packetReceiver.registerListener(PacketType::ICEPingReply, &_domainHandler, "processICEPingReplyPacket");
|
packetReceiver.registerListener(PacketType::ICEPingReply, &_domainHandler, "processICEPingReplyPacket");
|
||||||
packetReceiver.registerListener(PacketType::DomainServerPathResponse, this, "processDomainServerPathResponse");
|
packetReceiver.registerListener(PacketType::DomainServerPathResponse, this, "processDomainServerPathResponse");
|
||||||
|
packetReceiver.registerListener(PacketType::DomainServerRemovedNode, this, "processDomainServerRemovedNode");
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 NodeList::sendStats(const QJsonObject& statsObject, const HifiSockAddr& destination) {
|
qint64 NodeList::sendStats(const QJsonObject& statsObject, const HifiSockAddr& destination) {
|
||||||
|
@ -513,6 +514,13 @@ void NodeList::processDomainServerAddedNode(QSharedPointer<NLPacket> packet) {
|
||||||
parseNodeFromPacketStream(packetStream);
|
parseNodeFromPacketStream(packetStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeList::processDomainServerRemovedNode(QSharedPointer<NLPacket> packet) {
|
||||||
|
// read the UUID from the packet, remove it if it exists
|
||||||
|
QUuid nodeUUID = QUuid::fromRfc4122(packet->readWithoutCopy(NUM_BYTES_RFC4122_UUID));
|
||||||
|
qDebug() << "Received packet from domain-server to remove node with UUID" << uuidStringWithoutCurlyBraces(nodeUUID);
|
||||||
|
killNodeWithUUID(nodeUUID);
|
||||||
|
}
|
||||||
|
|
||||||
void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) {
|
void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) {
|
||||||
// setup variables to read into from QDataStream
|
// setup variables to read into from QDataStream
|
||||||
qint8 nodeType;
|
qint8 nodeType;
|
||||||
|
|
|
@ -74,6 +74,7 @@ public slots:
|
||||||
|
|
||||||
void processDomainServerList(QSharedPointer<NLPacket> packet);
|
void processDomainServerList(QSharedPointer<NLPacket> packet);
|
||||||
void processDomainServerAddedNode(QSharedPointer<NLPacket> packet);
|
void processDomainServerAddedNode(QSharedPointer<NLPacket> packet);
|
||||||
|
void processDomainServerRemovedNode(QSharedPointer<NLPacket> packet);
|
||||||
void processDomainServerPathResponse(QSharedPointer<NLPacket> packet);
|
void processDomainServerPathResponse(QSharedPointer<NLPacket> packet);
|
||||||
|
|
||||||
void processDomainServerConnectionTokenPacket(QSharedPointer<NLPacket> packet);
|
void processDomainServerConnectionTokenPacket(QSharedPointer<NLPacket> packet);
|
||||||
|
|
Loading…
Reference in a new issue