mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 23:16:50 +02:00
check if usernames do not match before using hint ID
This commit is contained in:
parent
3e97b07fc2
commit
9285c88e46
1 changed files with 14 additions and 8 deletions
|
@ -438,14 +438,20 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect
|
||||||
QUuid hintNodeID;
|
QUuid hintNodeID;
|
||||||
|
|
||||||
// in case this is a node that's failing to connect
|
// in case this is a node that's failing to connect
|
||||||
// double check we don't have a node whose sockets match exactly already in the list
|
// double check we don't have the same node whose sockets match exactly already in the list
|
||||||
limitedNodeList->eachNodeBreakable([&nodeConnection, &hintNodeID](const SharedNodePointer& node){
|
limitedNodeList->eachNodeBreakable([&nodeConnection, &hintNodeID, &username](const SharedNodePointer& node){
|
||||||
if (node->getPublicSocket() == nodeConnection.publicSockAddr
|
if (node->getPublicSocket() == nodeConnection.publicSockAddr && node->getLocalSocket() == nodeConnection.localSockAddr) {
|
||||||
&& node->getLocalSocket() == nodeConnection.localSockAddr) {
|
// we have a node that already has these exact sockets - this can occur if a node
|
||||||
// we have a node that already has these exact sockets - this occurs if a node
|
// is failing to connect to the domain
|
||||||
// is unable to connect to the domain
|
|
||||||
hintNodeID = node->getUUID();
|
// we'll re-use the existing node ID
|
||||||
return false;
|
// as long as the user hasn't changed their username (by logging in or logging out)
|
||||||
|
auto existingNodeData = static_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||||
|
|
||||||
|
if (existingNodeData->getUsername() == username) {
|
||||||
|
hintNodeID = node->getUUID();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue