mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:35:08 +02:00
Merge pull request #8223 from Atlante45/fix/crash-packet-list
Fix crash in packet list
This commit is contained in:
commit
03d5a0cb51
4 changed files with 10 additions and 2 deletions
|
@ -389,6 +389,8 @@ void DomainServer::setupNodeListAndAssignments() {
|
|||
const QVariant* idValueVariant = valueForKeyPath(settingsMap, METAVERSE_DOMAIN_ID_KEY_PATH);
|
||||
if (idValueVariant) {
|
||||
nodeList->setSessionUUID(idValueVariant->toString());
|
||||
} else {
|
||||
nodeList->setSessionUUID(QUuid::createUuid()); // Use random UUID
|
||||
}
|
||||
|
||||
connect(nodeList.data(), &LimitedNodeList::nodeAdded, this, &DomainServer::nodeAdded);
|
||||
|
|
|
@ -522,6 +522,7 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t
|
|||
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
||||
const NodePermissions& permissions,
|
||||
const QUuid& connectionSecret) {
|
||||
QReadLocker readLocker(&_nodeMutex);
|
||||
NodeHash::const_iterator it = _nodeHash.find(uuid);
|
||||
|
||||
if (it != _nodeHash.end()) {
|
||||
|
|
|
@ -131,7 +131,7 @@ public:
|
|||
|
||||
std::function<void(Node*)> linkedDataCreateCallback;
|
||||
|
||||
size_t size() const { return _nodeHash.size(); }
|
||||
size_t size() const { QReadLocker readLock(&_nodeMutex); return _nodeHash.size(); }
|
||||
|
||||
SharedNodePointer nodeWithUUID(const QUuid& nodeUUID);
|
||||
|
||||
|
@ -287,7 +287,7 @@ protected:
|
|||
|
||||
QUuid _sessionUUID;
|
||||
NodeHash _nodeHash;
|
||||
QReadWriteLock _nodeMutex;
|
||||
mutable QReadWriteLock _nodeMutex;
|
||||
udt::Socket _nodeSocket;
|
||||
QUdpSocket* _dtlsSocket;
|
||||
HifiSockAddr _localSockAddr;
|
||||
|
|
|
@ -513,6 +513,7 @@ void NodeList::processDomainServerConnectionTokenPacket(QSharedPointer<ReceivedM
|
|||
|
||||
void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message) {
|
||||
if (_domainHandler.getSockAddr().isNull()) {
|
||||
qWarning() << "IGNORING DomainList packet while not connected to a Domain Server";
|
||||
// refuse to process this packet if we aren't currently connected to the DS
|
||||
return;
|
||||
}
|
||||
|
@ -535,6 +536,10 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
|
|||
if (!_domainHandler.isConnected()) {
|
||||
_domainHandler.setUUID(domainUUID);
|
||||
_domainHandler.setIsConnected(true);
|
||||
} else if (_domainHandler.getUUID() != domainUUID) {
|
||||
// Recieved packet from different domain.
|
||||
qWarning() << "IGNORING DomainList packet from" << domainUUID << "while connected to" << _domainHandler.getUUID();
|
||||
return;
|
||||
}
|
||||
|
||||
// pull our owner UUID from the packet, it's always the first thing
|
||||
|
|
Loading…
Reference in a new issue