mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 22:16:58 +02:00
remove non-locking version of nodeWithUUID()
This commit is contained in:
parent
c6c4b58699
commit
55b9dd1aee
2 changed files with 4 additions and 14 deletions
|
@ -357,18 +357,9 @@ int NodeList::findNodeAndUpdateWithDataFromPacket(const QByteArray& packet) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedNodePointer NodeList::nodeWithUUID(const QUuid& nodeUUID, bool blockingLock) {
|
SharedNodePointer NodeList::nodeWithUUID(const QUuid& nodeUUID) {
|
||||||
SharedNodePointer node;
|
QMutexLocker locker(&_nodeHashMutex);
|
||||||
// if caller wants us to block and guarantee the correct answer, then honor that request
|
return _nodeHash.value(nodeUUID);
|
||||||
if (blockingLock) {
|
|
||||||
// this will block till we can get access
|
|
||||||
QMutexLocker locker(&_nodeHashMutex);
|
|
||||||
node = _nodeHash.value(nodeUUID);
|
|
||||||
} else if (_nodeHashMutex.tryLock()) { // some callers are willing to get wrong answers but not block
|
|
||||||
node = _nodeHash.value(nodeUUID);
|
|
||||||
_nodeHashMutex.unlock();
|
|
||||||
}
|
|
||||||
return node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedNodePointer NodeList::sendingNodeForPacket(const QByteArray& packet) {
|
SharedNodePointer NodeList::sendingNodeForPacket(const QByteArray& packet) {
|
||||||
|
|
|
@ -103,8 +103,7 @@ public:
|
||||||
QByteArray constructPingReplyPacket(const QByteArray& pingPacket);
|
QByteArray constructPingReplyPacket(const QByteArray& pingPacket);
|
||||||
void pingPublicAndLocalSocketsForInactiveNode(const SharedNodePointer& node);
|
void pingPublicAndLocalSocketsForInactiveNode(const SharedNodePointer& node);
|
||||||
|
|
||||||
/// passing false for blockingLock, will tryLock, and may return NULL when a node with the UUID actually does exist
|
SharedNodePointer nodeWithUUID(const QUuid& nodeUUID);
|
||||||
SharedNodePointer nodeWithUUID(const QUuid& nodeUUID, bool blockingLock = true);
|
|
||||||
SharedNodePointer sendingNodeForPacket(const QByteArray& packet);
|
SharedNodePointer sendingNodeForPacket(const QByteArray& packet);
|
||||||
|
|
||||||
SharedNodePointer addOrUpdateNode(const QUuid& uuid, char nodeType,
|
SharedNodePointer addOrUpdateNode(const QUuid& uuid, char nodeType,
|
||||||
|
|
Loading…
Reference in a new issue