mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 06:32:35 +02:00
Merge pull request #7015 from birarda/audio-mute-crash
rename canAdjustLocks to isAllowedEditor, add debug for crash
This commit is contained in:
commit
759b1a347c
10 changed files with 41 additions and 40 deletions
|
@ -551,7 +551,9 @@ void AudioMixer::handleNodeAudioPacket(QSharedPointer<ReceivedMessage> message,
|
|||
void AudioMixer::handleMuteEnvironmentPacket(QSharedPointer<ReceivedMessage> message, SharedNodePointer sendingNode) {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
if (sendingNode->getCanAdjustLocks()) {
|
||||
if (sendingNode->isAllowedEditor()) {
|
||||
qDebug() << "Received a mute environment packet of" << message->getSize() << "bytes";
|
||||
|
||||
auto newPacket = NLPacket::create(PacketType::MuteEnvironment, message->getSize());
|
||||
// Copy payload
|
||||
newPacket->write(message->getRawMessage(), message->getSize());
|
||||
|
|
|
@ -155,7 +155,7 @@ SharedNodePointer DomainGatekeeper::processAssignmentConnectRequest(const NodeCo
|
|||
_pendingAssignedNodes.erase(it);
|
||||
|
||||
// always allow assignment clients to create and destroy entities
|
||||
newNode->setCanAdjustLocks(true);
|
||||
newNode->setIsAllowedEditor(true);
|
||||
newNode->setCanRez(true);
|
||||
|
||||
return newNode;
|
||||
|
@ -219,13 +219,13 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect
|
|||
}
|
||||
}
|
||||
|
||||
// if this user is in the editors list (or if the editors list is empty) set the user's node's canAdjustLocks to true
|
||||
// if this user is in the editors list (or if the editors list is empty) set the user's node's isAllowedEditor to true
|
||||
const QVariant* allowedEditorsVariant =
|
||||
valueForKeyPath(_server->_settingsManager.getSettingsMap(), ALLOWED_EDITORS_SETTINGS_KEYPATH);
|
||||
QStringList allowedEditors = allowedEditorsVariant ? allowedEditorsVariant->toStringList() : QStringList();
|
||||
|
||||
// if the allowed editors list is empty then everyone can adjust locks
|
||||
bool canAdjustLocks = allowedEditors.empty();
|
||||
bool isAllowedEditor = allowedEditors.empty();
|
||||
|
||||
if (allowedEditors.contains(username, Qt::CaseInsensitive)) {
|
||||
// we have a non-empty allowed editors list - check if this user is verified to be in it
|
||||
|
@ -238,10 +238,10 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect
|
|||
<< "will be given edit rights to avoid a thrasing of public key requests and connect requests.";
|
||||
}
|
||||
|
||||
canAdjustLocks = true;
|
||||
isAllowedEditor = true;
|
||||
} else {
|
||||
// already verified this user and they are in the allowed editors list
|
||||
canAdjustLocks = true;
|
||||
isAllowedEditor = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,14 +256,14 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect
|
|||
|
||||
bool canRez = true;
|
||||
if (onlyEditorsAreRezzers) {
|
||||
canRez = canAdjustLocks;
|
||||
canRez = isAllowedEditor;
|
||||
}
|
||||
|
||||
// add the new node
|
||||
SharedNodePointer newNode = addVerifiedNodeFromConnectRequest(nodeConnection);
|
||||
|
||||
// set the edit rights for this user
|
||||
newNode->setCanAdjustLocks(canAdjustLocks);
|
||||
newNode->setIsAllowedEditor(isAllowedEditor);
|
||||
newNode->setCanRez(canRez);
|
||||
|
||||
// grab the linked data for our new node so we can set the username
|
||||
|
|
|
@ -744,7 +744,7 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif
|
|||
|
||||
extendedHeaderStream << limitedNodeList->getSessionUUID();
|
||||
extendedHeaderStream << node->getUUID();
|
||||
extendedHeaderStream << (quint8) node->getCanAdjustLocks();
|
||||
extendedHeaderStream << (quint8) node->isAllowedEditor();
|
||||
extendedHeaderStream << (quint8) node->getCanRez();
|
||||
|
||||
auto domainListPackets = NLPacketList::create(PacketType::DomainList, extendedHeader);
|
||||
|
|
|
@ -29,7 +29,7 @@ EntityScriptingInterface::EntityScriptingInterface() :
|
|||
_entityTree(NULL)
|
||||
{
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
connect(nodeList.data(), &NodeList::canAdjustLocksChanged, this, &EntityScriptingInterface::canAdjustLocksChanged);
|
||||
connect(nodeList.data(), &NodeList::isAllowedEditorChanged, this, &EntityScriptingInterface::canAdjustLocksChanged);
|
||||
connect(nodeList.data(), &NodeList::canRezChanged, this, &EntityScriptingInterface::canRezChanged);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ void EntityScriptingInterface::queueEntityMessage(PacketType packetType,
|
|||
|
||||
bool EntityScriptingInterface::canAdjustLocks() {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
return nodeList->getThisNodeCanAdjustLocks();
|
||||
return nodeList->isAllowedEditor();
|
||||
}
|
||||
|
||||
bool EntityScriptingInterface::canRez() {
|
||||
|
|
|
@ -124,10 +124,10 @@ bool EntityTree::updateEntityWithElement(EntityItemPointer entity, const EntityI
|
|||
QUuid senderID;
|
||||
if (senderNode.isNull()) {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
allowLockChange = nodeList->getThisNodeCanAdjustLocks();
|
||||
allowLockChange = nodeList->isAllowedEditor();
|
||||
senderID = nodeList->getSessionUUID();
|
||||
} else {
|
||||
allowLockChange = senderNode->getCanAdjustLocks();
|
||||
allowLockChange = senderNode->isAllowedEditor();
|
||||
senderID = senderNode->getUUID();
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ LimitedNodeList::LimitedNodeList(unsigned short socketListenPort, unsigned short
|
|||
_numCollectedPackets(0),
|
||||
_numCollectedBytes(0),
|
||||
_packetStatTimer(),
|
||||
_thisNodeCanAdjustLocks(false),
|
||||
_thisNodeCanRez(true)
|
||||
{
|
||||
static bool firstCall = true;
|
||||
|
@ -131,10 +130,10 @@ void LimitedNodeList::setSessionUUID(const QUuid& sessionUUID) {
|
|||
}
|
||||
}
|
||||
|
||||
void LimitedNodeList::setThisNodeCanAdjustLocks(bool canAdjustLocks) {
|
||||
if (_thisNodeCanAdjustLocks != canAdjustLocks) {
|
||||
_thisNodeCanAdjustLocks = canAdjustLocks;
|
||||
emit canAdjustLocksChanged(canAdjustLocks);
|
||||
void LimitedNodeList::setIsAllowedEditor(bool isAllowedEditor) {
|
||||
if (_isAllowedEditor != isAllowedEditor) {
|
||||
_isAllowedEditor = isAllowedEditor;
|
||||
emit isAllowedEditorChanged(isAllowedEditor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -515,7 +514,7 @@ void LimitedNodeList::handleNodeKill(const SharedNodePointer& node) {
|
|||
|
||||
SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
|
||||
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
||||
bool canAdjustLocks, bool canRez,
|
||||
bool isAllowedEditor, bool canRez,
|
||||
const QUuid& connectionSecret) {
|
||||
NodeHash::const_iterator it = _nodeHash.find(uuid);
|
||||
|
||||
|
@ -524,14 +523,14 @@ SharedNodePointer LimitedNodeList::addOrUpdateNode(const QUuid& uuid, NodeType_t
|
|||
|
||||
matchingNode->setPublicSocket(publicSocket);
|
||||
matchingNode->setLocalSocket(localSocket);
|
||||
matchingNode->setCanAdjustLocks(canAdjustLocks);
|
||||
matchingNode->setIsAllowedEditor(isAllowedEditor);
|
||||
matchingNode->setCanRez(canRez);
|
||||
matchingNode->setConnectionSecret(connectionSecret);
|
||||
|
||||
return matchingNode;
|
||||
} else {
|
||||
// we didn't have this node, so add them
|
||||
Node* newNode = new Node(uuid, nodeType, publicSocket, localSocket, canAdjustLocks, canRez, connectionSecret, this);
|
||||
Node* newNode = new Node(uuid, nodeType, publicSocket, localSocket, isAllowedEditor, canRez, connectionSecret, this);
|
||||
|
||||
if (nodeType == NodeType::AudioMixer) {
|
||||
LimitedNodeList::flagTimeForConnectionStep(LimitedNodeList::AddedAudioMixer);
|
||||
|
|
|
@ -104,8 +104,8 @@ public:
|
|||
const QUuid& getSessionUUID() const { return _sessionUUID; }
|
||||
void setSessionUUID(const QUuid& sessionUUID);
|
||||
|
||||
bool getThisNodeCanAdjustLocks() const { return _thisNodeCanAdjustLocks; }
|
||||
void setThisNodeCanAdjustLocks(bool canAdjustLocks);
|
||||
bool isAllowedEditor() const { return _isAllowedEditor; }
|
||||
void setIsAllowedEditor(bool isAllowedEditor);
|
||||
|
||||
bool getThisNodeCanRez() const { return _thisNodeCanRez; }
|
||||
void setThisNodeCanRez(bool canRez);
|
||||
|
@ -137,7 +137,7 @@ public:
|
|||
|
||||
SharedNodePointer addOrUpdateNode(const QUuid& uuid, NodeType_t nodeType,
|
||||
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
||||
bool canAdjustLocks = false, bool canRez = false,
|
||||
bool isAllowedEditor = false, bool canRez = false,
|
||||
const QUuid& connectionSecret = QUuid());
|
||||
|
||||
bool hasCompletedInitialSTUN() const { return _hasCompletedInitialSTUN; }
|
||||
|
@ -244,7 +244,7 @@ signals:
|
|||
void localSockAddrChanged(const HifiSockAddr& localSockAddr);
|
||||
void publicSockAddrChanged(const HifiSockAddr& publicSockAddr);
|
||||
|
||||
void canAdjustLocksChanged(bool canAdjustLocks);
|
||||
void isAllowedEditorChanged(bool isAllowedEditor);
|
||||
void canRezChanged(bool canRez);
|
||||
|
||||
protected:
|
||||
|
@ -289,7 +289,7 @@ protected:
|
|||
int _numCollectedBytes;
|
||||
|
||||
QElapsedTimer _packetStatTimer;
|
||||
bool _thisNodeCanAdjustLocks;
|
||||
bool _isAllowedEditor { false };
|
||||
bool _thisNodeCanRez;
|
||||
|
||||
QPointer<QTimer> _initialSTUNTimer;
|
||||
|
|
|
@ -47,7 +47,7 @@ const QString& NodeType::getNodeTypeName(NodeType_t nodeType) {
|
|||
}
|
||||
|
||||
Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket,
|
||||
const HifiSockAddr& localSocket, bool canAdjustLocks, bool canRez, const QUuid& connectionSecret,
|
||||
const HifiSockAddr& localSocket, bool isAllowedEditor, bool canRez, const QUuid& connectionSecret,
|
||||
QObject* parent) :
|
||||
NetworkPeer(uuid, publicSocket, localSocket, parent),
|
||||
_type(type),
|
||||
|
@ -57,7 +57,7 @@ Node::Node(const QUuid& uuid, NodeType_t type, const HifiSockAddr& publicSocket,
|
|||
_clockSkewUsec(0),
|
||||
_mutex(),
|
||||
_clockSkewMovingPercentile(30, 0.8f), // moving 80th percentile of 30 samples
|
||||
_canAdjustLocks(canAdjustLocks),
|
||||
_isAllowedEditor(isAllowedEditor),
|
||||
_canRez(canRez)
|
||||
{
|
||||
// Update socket's object name
|
||||
|
@ -84,7 +84,7 @@ QDataStream& operator<<(QDataStream& out, const Node& node) {
|
|||
out << node._uuid;
|
||||
out << node._publicSocket;
|
||||
out << node._localSocket;
|
||||
out << node._canAdjustLocks;
|
||||
out << node._isAllowedEditor;
|
||||
out << node._canRez;
|
||||
|
||||
return out;
|
||||
|
@ -95,7 +95,7 @@ QDataStream& operator>>(QDataStream& in, Node& node) {
|
|||
in >> node._uuid;
|
||||
in >> node._publicSocket;
|
||||
in >> node._localSocket;
|
||||
in >> node._canAdjustLocks;
|
||||
in >> node._isAllowedEditor;
|
||||
in >> node._canRez;
|
||||
|
||||
return in;
|
||||
|
|
|
@ -33,7 +33,7 @@ class Node : public NetworkPeer {
|
|||
public:
|
||||
Node(const QUuid& uuid, NodeType_t type,
|
||||
const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket,
|
||||
bool canAdjustLocks, bool canRez, const QUuid& connectionSecret = QUuid(),
|
||||
bool isAllowedEditor, bool canRez, const QUuid& connectionSecret = QUuid(),
|
||||
QObject* parent = 0);
|
||||
|
||||
bool operator==(const Node& otherNode) const { return _uuid == otherNode._uuid; }
|
||||
|
@ -58,8 +58,8 @@ public:
|
|||
void updateClockSkewUsec(int clockSkewSample);
|
||||
QMutex& getMutex() { return _mutex; }
|
||||
|
||||
void setCanAdjustLocks(bool canAdjustLocks) { _canAdjustLocks = canAdjustLocks; }
|
||||
bool getCanAdjustLocks() { return _canAdjustLocks; }
|
||||
void setIsAllowedEditor(bool isAllowedEditor) { _isAllowedEditor = isAllowedEditor; }
|
||||
bool isAllowedEditor() { return _isAllowedEditor; }
|
||||
|
||||
void setCanRez(bool canRez) { _canRez = canRez; }
|
||||
bool getCanRez() { return _canRez; }
|
||||
|
@ -81,7 +81,7 @@ private:
|
|||
int _clockSkewUsec;
|
||||
QMutex _mutex;
|
||||
MovingPercentile _clockSkewMovingPercentile;
|
||||
bool _canAdjustLocks;
|
||||
bool _isAllowedEditor;
|
||||
bool _canRez;
|
||||
};
|
||||
|
||||
|
|
|
@ -512,9 +512,9 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
|
|||
packetStream >> newUUID;
|
||||
setSessionUUID(newUUID);
|
||||
|
||||
quint8 thisNodeCanAdjustLocks;
|
||||
packetStream >> thisNodeCanAdjustLocks;
|
||||
setThisNodeCanAdjustLocks((bool) thisNodeCanAdjustLocks);
|
||||
quint8 isAllowedEditor;
|
||||
packetStream >> isAllowedEditor;
|
||||
setIsAllowedEditor((bool) isAllowedEditor);
|
||||
|
||||
quint8 thisNodeCanRez;
|
||||
packetStream >> thisNodeCanRez;
|
||||
|
@ -546,10 +546,10 @@ void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) {
|
|||
qint8 nodeType;
|
||||
QUuid nodeUUID, connectionUUID;
|
||||
HifiSockAddr nodePublicSocket, nodeLocalSocket;
|
||||
bool canAdjustLocks;
|
||||
bool isAllowedEditor;
|
||||
bool canRez;
|
||||
|
||||
packetStream >> nodeType >> nodeUUID >> nodePublicSocket >> nodeLocalSocket >> canAdjustLocks >> canRez;
|
||||
packetStream >> nodeType >> nodeUUID >> nodePublicSocket >> nodeLocalSocket >> isAllowedEditor >> canRez;
|
||||
|
||||
// if the public socket address is 0 then it's reachable at the same IP
|
||||
// as the domain server
|
||||
|
@ -560,7 +560,7 @@ void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) {
|
|||
packetStream >> connectionUUID;
|
||||
|
||||
SharedNodePointer node = addOrUpdateNode(nodeUUID, nodeType, nodePublicSocket,
|
||||
nodeLocalSocket, canAdjustLocks, canRez,
|
||||
nodeLocalSocket, isAllowedEditor, canRez,
|
||||
connectionUUID);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue