mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 08:17:35 +02:00
remove version conflict markers accidentally committed
This commit is contained in:
parent
80cf7b6c76
commit
0f36385b86
1 changed files with 1 additions and 204 deletions
|
@ -289,18 +289,13 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
||||||
packetReceiver.registerListener(PacketType::DomainListRequest, this, "processListRequestPacket");
|
packetReceiver.registerListener(PacketType::DomainListRequest, this, "processListRequestPacket");
|
||||||
packetReceiver.registerListener(PacketType::DomainServerPathQuery, this, "processPathQueryPacket");
|
packetReceiver.registerListener(PacketType::DomainServerPathQuery, this, "processPathQueryPacket");
|
||||||
packetReceiver.registerListener(PacketType::NodeJsonStats, this, "processNodeJSONStatsPacket");
|
packetReceiver.registerListener(PacketType::NodeJsonStats, this, "processNodeJSONStatsPacket");
|
||||||
<<<<<<< HEAD
|
|
||||||
packetReceiver.registerListener(PacketType::ICEPing, this, "processICEPingPacket");
|
|
||||||
packetReceiver.registerListener(PacketType::ICEPingReply, this, "processICEPingReplyPacket");
|
|
||||||
packetReceiver.registerListener(PacketType::ICEServerPeerInformation, this, "processICEPeerInformationPacket");
|
|
||||||
|
|
||||||
// NodeList won't be available to the settings manager when it is created, so call registerListener here
|
// NodeList won't be available to the settings manager when it is created, so call registerListener here
|
||||||
packetReceiver.registerListener(PacketType::DomainSettingsRequest, &_settingsManager, "processSettingsRequestPacket");
|
packetReceiver.registerListener(PacketType::DomainSettingsRequest, &_settingsManager, "processSettingsRequestPacket");
|
||||||
=======
|
|
||||||
packetReceiver.registerListener(PacketType::ICEPing, &_gatekeeper, "processICEPingPacket");
|
packetReceiver.registerListener(PacketType::ICEPing, &_gatekeeper, "processICEPingPacket");
|
||||||
packetReceiver.registerListener(PacketType::ICEPingReply, &_gatekeeper, "processICEPingReplyPacket");
|
packetReceiver.registerListener(PacketType::ICEPingReply, &_gatekeeper, "processICEPingReplyPacket");
|
||||||
packetReceiver.registerListener(PacketType::ICEServerPeerInformation, &_gatekeeper, "processICEPeerInformationPacket");
|
packetReceiver.registerListener(PacketType::ICEServerPeerInformation, &_gatekeeper, "processICEPeerInformationPacket");
|
||||||
>>>>>>> d0db56a4a6902e9d1ee706ec02152e94688f4e5c
|
|
||||||
|
|
||||||
// add whatever static assignments that have been parsed to the queue
|
// add whatever static assignments that have been parsed to the queue
|
||||||
addStaticAssignmentsToQueue();
|
addStaticAssignmentsToQueue();
|
||||||
|
@ -584,204 +579,6 @@ void DomainServer::populateDefaultStaticAssignmentsExcludingTypes(const QSet<Ass
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
const NodeSet STATICALLY_ASSIGNED_NODES = NodeSet() << NodeType::AudioMixer
|
|
||||||
<< NodeType::AvatarMixer << NodeType::EntityServer;
|
|
||||||
|
|
||||||
void DomainServer::processConnectRequestPacket(QSharedPointer<NLPacket> packet) {
|
|
||||||
NodeType_t nodeType;
|
|
||||||
HifiSockAddr publicSockAddr, localSockAddr;
|
|
||||||
|
|
||||||
if (packet->getPayloadSize() == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDataStream packetStream(packet.data());
|
|
||||||
|
|
||||||
QUuid connectUUID;
|
|
||||||
packetStream >> connectUUID;
|
|
||||||
|
|
||||||
const HifiSockAddr& senderSockAddr = packet->getSenderSockAddr();
|
|
||||||
|
|
||||||
parseNodeData(packetStream, nodeType, publicSockAddr, localSockAddr, senderSockAddr);
|
|
||||||
|
|
||||||
if (localSockAddr.isNull() || senderSockAddr.isNull()) {
|
|
||||||
qDebug() << "Unexpected data received for node local socket or public socket. Will not allow connection.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if this connect request matches an assignment in the queue
|
|
||||||
bool isAssignment = _pendingAssignedNodes.contains(connectUUID);
|
|
||||||
SharedAssignmentPointer matchingQueuedAssignment = SharedAssignmentPointer();
|
|
||||||
PendingAssignedNodeData* pendingAssigneeData = NULL;
|
|
||||||
|
|
||||||
if (isAssignment) {
|
|
||||||
pendingAssigneeData = _pendingAssignedNodes.value(connectUUID);
|
|
||||||
|
|
||||||
if (pendingAssigneeData) {
|
|
||||||
matchingQueuedAssignment = matchingQueuedAssignmentForCheckIn(pendingAssigneeData->getAssignmentUUID(), nodeType);
|
|
||||||
|
|
||||||
if (matchingQueuedAssignment) {
|
|
||||||
qDebug() << "Assignment deployed with" << uuidStringWithoutCurlyBraces(connectUUID)
|
|
||||||
<< "matches unfulfilled assignment"
|
|
||||||
<< uuidStringWithoutCurlyBraces(matchingQueuedAssignment->getUUID());
|
|
||||||
|
|
||||||
// remove this unique assignment deployment from the hash of pending assigned nodes
|
|
||||||
// cleanup of the PendingAssignedNodeData happens below after the node has been added to the LimitedNodeList
|
|
||||||
_pendingAssignedNodes.remove(connectUUID);
|
|
||||||
} else {
|
|
||||||
// this is a node connecting to fulfill an assignment that doesn't exist
|
|
||||||
// don't reply back to them so they cycle back and re-request an assignment
|
|
||||||
qDebug() << "No match for assignment deployed with" << uuidStringWithoutCurlyBraces(connectUUID);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<NodeType_t> nodeInterestList;
|
|
||||||
QString username;
|
|
||||||
QByteArray usernameSignature;
|
|
||||||
|
|
||||||
auto limitedNodeList = DependencyManager::get<LimitedNodeList>();
|
|
||||||
|
|
||||||
packetStream >> nodeInterestList;
|
|
||||||
|
|
||||||
if (packet->bytesLeftToRead() > 0) {
|
|
||||||
// try to verify username
|
|
||||||
packetStream >> username;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isRestrictingAccess =
|
|
||||||
_settingsManager.valueOrDefaultValueForKeyPath(RESTRICTED_ACCESS_SETTINGS_KEYPATH).toBool();
|
|
||||||
|
|
||||||
// we always let in a user who is sending a packet from our local socket or from the localhost address
|
|
||||||
bool isLocalUser = (senderSockAddr.getAddress() == DependencyManager::get<LimitedNodeList>()->getLocalSockAddr().getAddress() || senderSockAddr.getAddress() == QHostAddress::LocalHost);
|
|
||||||
|
|
||||||
if (isRestrictingAccess && !isLocalUser) {
|
|
||||||
if (!username.isEmpty()) {
|
|
||||||
// if there's a username, try to unpack username signature
|
|
||||||
packetStream >> usernameSignature;
|
|
||||||
|
|
||||||
if (usernameSignature.isEmpty()) {
|
|
||||||
// if user didn't include usernameSignature in connect request, send a connectionToken packet
|
|
||||||
QUuid& connectionToken = _connectionTokenHash[username.toLower()];
|
|
||||||
|
|
||||||
if (connectionToken.isNull()) {
|
|
||||||
connectionToken = QUuid::createUuid();
|
|
||||||
}
|
|
||||||
|
|
||||||
static auto connectionTokenPacket = NLPacket::create(PacketType::DomainServerConnectionToken, NUM_BYTES_RFC4122_UUID);
|
|
||||||
connectionTokenPacket->reset();
|
|
||||||
connectionTokenPacket->write(connectionToken.toRfc4122());
|
|
||||||
limitedNodeList->sendUnreliablePacket(*connectionTokenPacket, packet->getSenderSockAddr());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString reason;
|
|
||||||
if (!isAssignment && !shouldAllowConnectionFromNode(username, usernameSignature, senderSockAddr, reason)) {
|
|
||||||
// this is an agent and we've decided we won't let them connect - send them a packet to deny connection
|
|
||||||
QByteArray utfString = reason.toUtf8();
|
|
||||||
quint16 payloadSize = utfString.size();
|
|
||||||
|
|
||||||
auto connectionDeniedPacket = NLPacket::create(PacketType::DomainConnectionDenied, payloadSize + sizeof(payloadSize));
|
|
||||||
if (payloadSize > 0) {
|
|
||||||
connectionDeniedPacket->writePrimitive(payloadSize);
|
|
||||||
connectionDeniedPacket->write(utfString);
|
|
||||||
}
|
|
||||||
// tell client it has been refused.
|
|
||||||
limitedNodeList->sendPacket(std::move(connectionDeniedPacket), senderSockAddr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((!isAssignment && !STATICALLY_ASSIGNED_NODES.contains(nodeType))
|
|
||||||
|| (isAssignment && matchingQueuedAssignment)) {
|
|
||||||
// this was either not a static assignment or it was and we had a matching one in the queue
|
|
||||||
|
|
||||||
QUuid nodeUUID;
|
|
||||||
|
|
||||||
HifiSockAddr discoveredSocket = senderSockAddr;
|
|
||||||
SharedNetworkPeer connectedPeer = _icePeers.value(connectUUID);
|
|
||||||
|
|
||||||
if (connectedPeer) {
|
|
||||||
// this user negotiated a connection with us via ICE, so re-use their ICE client ID
|
|
||||||
nodeUUID = connectUUID;
|
|
||||||
|
|
||||||
if (connectedPeer->getActiveSocket()) {
|
|
||||||
// set their discovered socket to whatever the activated socket on the network peer object was
|
|
||||||
discoveredSocket = *connectedPeer->getActiveSocket();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// we got a connectUUID we didn't recognize, just add the node with a new UUID
|
|
||||||
nodeUUID = QUuid::createUuid();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if this user is in the editors list (or if the editors list is empty) set the user's node's canAdjustLocks to true
|
|
||||||
const QVariant* allowedEditorsVariant =
|
|
||||||
valueForKeyPath(_settingsManager.getSettingsMap(), ALLOWED_EDITORS_SETTINGS_KEYPATH);
|
|
||||||
QStringList allowedEditors = allowedEditorsVariant ? allowedEditorsVariant->toStringList() : QStringList();
|
|
||||||
bool canAdjustLocks = allowedEditors.isEmpty() || allowedEditors.contains(username);
|
|
||||||
|
|
||||||
const QVariant* editorsAreRezzersVariant =
|
|
||||||
valueForKeyPath(_settingsManager.getSettingsMap(), EDITORS_ARE_REZZERS_KEYPATH);
|
|
||||||
|
|
||||||
bool onlyEditorsAreRezzers = false;
|
|
||||||
if (editorsAreRezzersVariant) {
|
|
||||||
onlyEditorsAreRezzers = editorsAreRezzersVariant->toBool();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool canRez = true;
|
|
||||||
if (onlyEditorsAreRezzers) {
|
|
||||||
canRez = canAdjustLocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
SharedNodePointer newNode = limitedNodeList->addOrUpdateNode(nodeUUID, nodeType,
|
|
||||||
publicSockAddr, localSockAddr,
|
|
||||||
canAdjustLocks, canRez);
|
|
||||||
|
|
||||||
// So that we can send messages to this node at will - we need to activate the correct socket on this node now
|
|
||||||
newNode->activateMatchingOrNewSymmetricSocket(discoveredSocket);
|
|
||||||
|
|
||||||
// when the newNode is created the linked data is also created
|
|
||||||
// if this was a static assignment set the UUID, set the sendingSockAddr
|
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(newNode->getLinkedData());
|
|
||||||
|
|
||||||
if (isAssignment) {
|
|
||||||
nodeData->setAssignmentUUID(matchingQueuedAssignment->getUUID());
|
|
||||||
nodeData->setWalletUUID(pendingAssigneeData->getWalletUUID());
|
|
||||||
nodeData->setNodeVersion(pendingAssigneeData->getNodeVersion());
|
|
||||||
|
|
||||||
// always allow assignment clients to create and destroy entities
|
|
||||||
newNode->setCanAdjustLocks(true);
|
|
||||||
newNode->setCanRez(true);
|
|
||||||
|
|
||||||
// now that we've pulled the wallet UUID and added the node to our list, delete the pending assignee data
|
|
||||||
delete pendingAssigneeData;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!username.isEmpty()) {
|
|
||||||
// if we have a username from the connect request, set it on the DomainServerNodeData
|
|
||||||
nodeData->setUsername(username);
|
|
||||||
|
|
||||||
// also add an interpolation to JSONBreakableMarshal so that servers can get username in stats
|
|
||||||
JSONBreakableMarshal::addInterpolationForKey(USERNAME_UUID_REPLACEMENT_STATS_KEY,
|
|
||||||
uuidStringWithoutCurlyBraces(nodeUUID), username);
|
|
||||||
}
|
|
||||||
|
|
||||||
nodeData->setSendingSockAddr(senderSockAddr);
|
|
||||||
|
|
||||||
// reply back to the user with a PacketType::DomainList
|
|
||||||
sendDomainListToNode(newNode, senderSockAddr, nodeInterestList.toSet());
|
|
||||||
|
|
||||||
// send out this node to our other connected nodes
|
|
||||||
broadcastNewNode(newNode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> d0db56a4a6902e9d1ee706ec02152e94688f4e5c
|
|
||||||
void DomainServer::processListRequestPacket(QSharedPointer<NLPacket> packet, SharedNodePointer sendingNode) {
|
void DomainServer::processListRequestPacket(QSharedPointer<NLPacket> packet, SharedNodePointer sendingNode) {
|
||||||
|
|
||||||
QDataStream packetStream(packet.data());
|
QDataStream packetStream(packet.data());
|
||||||
|
|
Loading…
Reference in a new issue