mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 00:36:47 +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);
|
const QVariant* idValueVariant = valueForKeyPath(settingsMap, METAVERSE_DOMAIN_ID_KEY_PATH);
|
||||||
if (idValueVariant) {
|
if (idValueVariant) {
|
||||||
nodeList->setSessionUUID(idValueVariant->toString());
|
nodeList->setSessionUUID(idValueVariant->toString());
|
||||||
|
} else {
|
||||||
|
nodeList->setSessionUUID(QUuid::createUuid()); // Use random UUID
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(nodeList.data(), &LimitedNodeList::nodeAdded, this, &DomainServer::nodeAdded);
|
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 HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
||||||
const NodePermissions& permissions,
|
const NodePermissions& permissions,
|
||||||
const QUuid& connectionSecret) {
|
const QUuid& connectionSecret) {
|
||||||
|
QReadLocker readLocker(&_nodeMutex);
|
||||||
NodeHash::const_iterator it = _nodeHash.find(uuid);
|
NodeHash::const_iterator it = _nodeHash.find(uuid);
|
||||||
|
|
||||||
if (it != _nodeHash.end()) {
|
if (it != _nodeHash.end()) {
|
||||||
|
|
|
@ -131,7 +131,7 @@ public:
|
||||||
|
|
||||||
std::function<void(Node*)> linkedDataCreateCallback;
|
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);
|
SharedNodePointer nodeWithUUID(const QUuid& nodeUUID);
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ protected:
|
||||||
|
|
||||||
QUuid _sessionUUID;
|
QUuid _sessionUUID;
|
||||||
NodeHash _nodeHash;
|
NodeHash _nodeHash;
|
||||||
QReadWriteLock _nodeMutex;
|
mutable QReadWriteLock _nodeMutex;
|
||||||
udt::Socket _nodeSocket;
|
udt::Socket _nodeSocket;
|
||||||
QUdpSocket* _dtlsSocket;
|
QUdpSocket* _dtlsSocket;
|
||||||
HifiSockAddr _localSockAddr;
|
HifiSockAddr _localSockAddr;
|
||||||
|
|
|
@ -513,6 +513,7 @@ void NodeList::processDomainServerConnectionTokenPacket(QSharedPointer<ReceivedM
|
||||||
|
|
||||||
void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message) {
|
void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message) {
|
||||||
if (_domainHandler.getSockAddr().isNull()) {
|
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
|
// refuse to process this packet if we aren't currently connected to the DS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -535,6 +536,10 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
|
||||||
if (!_domainHandler.isConnected()) {
|
if (!_domainHandler.isConnected()) {
|
||||||
_domainHandler.setUUID(domainUUID);
|
_domainHandler.setUUID(domainUUID);
|
||||||
_domainHandler.setIsConnected(true);
|
_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
|
// pull our owner UUID from the packet, it's always the first thing
|
||||||
|
|
Loading…
Reference in a new issue