mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 15:33:35 +02:00
re-broadcast disconnects from domain-server
This commit is contained in:
parent
1c9396d66e
commit
e52e9be44c
3 changed files with 24 additions and 5 deletions
|
@ -1832,7 +1832,21 @@ void DomainServer::processNodeDisconnectRequestPacket(QSharedPointer<NLPacket> p
|
|||
// This packet has been matched to a source node and they're asking not to be in the domain anymore
|
||||
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
||||
|
||||
qDebug() << "Received a disconnect request from node with UUID" << packet->getSourceID();
|
||||
const QUuid& nodeUUID = packet->getSourceID();
|
||||
|
||||
limitedNodeList->killNodeWithUUID(packet->getSourceID());
|
||||
qDebug() << "Received a disconnect request from node with UUID" << nodeUUID;
|
||||
|
||||
if (limitedNodeList->nodeWithUUID(nodeUUID)) {
|
||||
limitedNodeList->killNodeWithUUID(nodeUUID);
|
||||
|
||||
static auto removedNodePacket = NLPacket::create(PacketType::DomainServerRemovedNode, NUM_BYTES_RFC4122_UUID);
|
||||
|
||||
removedNodePacket->reset();
|
||||
removedNodePacket->write(nodeUUID.toRfc4122());
|
||||
|
||||
// broadcast out the DomainServerRemovedNode message
|
||||
limitedNodeList->eachNode([&limitedNodeList](const SharedNodePointer& otherNode){
|
||||
limitedNodeList->sendUnreliablePacket(*removedNodePacket, *otherNode);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ class DomainHandler : public QObject {
|
|||
public:
|
||||
DomainHandler(QObject* parent = 0);
|
||||
|
||||
void disconnect();
|
||||
void clearSettings();
|
||||
|
||||
const QUuid& getUUID() const { return _uuid; }
|
||||
|
@ -112,7 +113,6 @@ signals:
|
|||
void settingsReceiveFail();
|
||||
|
||||
private:
|
||||
void disconnect();
|
||||
void sendDisconnectPacket();
|
||||
void hardReset();
|
||||
|
||||
|
|
|
@ -33,14 +33,19 @@ void ThreadedAssignment::setFinished(bool isFinished) {
|
|||
if (_isFinished) {
|
||||
|
||||
qDebug() << "ThreadedAssignment::setFinished(true) called - finishing up.";
|
||||
|
||||
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
auto& packetReceiver = nodeList->getPacketReceiver();
|
||||
|
||||
// we should de-register immediately for any of our packets
|
||||
packetReceiver.unregisterListener(this);
|
||||
|
||||
// we should also tell the packet receiver to drop packets while we're cleaning up
|
||||
packetReceiver.setShouldDropPackets(true);
|
||||
|
||||
// send a disconnect packet to the domain
|
||||
nodeList->getDomainHandler().disconnect();
|
||||
|
||||
if (_domainServerTimer) {
|
||||
// stop the domain-server check in timer by calling deleteLater so it gets cleaned up on NL thread
|
||||
|
|
Loading…
Reference in a new issue