Revert "Revert "Fix crash in packet list""

This commit is contained in:
Clément Brisset 2016-07-08 18:32:59 -07:00 committed by Atlante45
parent bcee128de0
commit 2f07f0d24f
4 changed files with 12 additions and 2 deletions

View file

@ -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);

View file

@ -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()) {

View file

@ -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;

View file

@ -513,9 +513,16 @@ 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;
}
QUuid domainHandlerUUID = _domainHandler.getUUID();
QUuid messageSourceUUID = message->getSourceID();
if (!domainHandlerUUID.isNull() && domainHandlerUUID != messageSourceUUID) {
qWarning() << "IGNORING DomainList packet from" << messageSourceUUID << "while connected to" << domainHandlerUUID;
return;
}
// this is a packet from the domain server, reset the count of un-replied check-ins
_numNoReplyDomainCheckIns = 0;