mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:55:00 +02:00
fix needless reinterpret_cast for DomainServerNodeData
This commit is contained in:
parent
c8d505c482
commit
fb8d2e34fb
3 changed files with 15 additions and 15 deletions
|
@ -107,7 +107,7 @@ void DomainGatekeeper::processConnectRequestPacket(QSharedPointer<ReceivedMessag
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
// set the sending sock addr and node interest set on this node
|
// set the sending sock addr and node interest set on this node
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(node->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||||
nodeData->setSendingSockAddr(message->getSenderSockAddr());
|
nodeData->setSendingSockAddr(message->getSenderSockAddr());
|
||||||
|
|
||||||
// guard against patched agents asking to hear about other agents
|
// guard against patched agents asking to hear about other agents
|
||||||
|
@ -283,7 +283,7 @@ void DomainGatekeeper::updateNodePermissions() {
|
||||||
QString hardwareAddress;
|
QString hardwareAddress;
|
||||||
QUuid machineFingerprint;
|
QUuid machineFingerprint;
|
||||||
|
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(node->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||||
if (nodeData) {
|
if (nodeData) {
|
||||||
hardwareAddress = nodeData->getHardwareAddress();
|
hardwareAddress = nodeData->getHardwareAddress();
|
||||||
machineFingerprint = nodeData->getMachineFingerprint();
|
machineFingerprint = nodeData->getMachineFingerprint();
|
||||||
|
@ -336,7 +336,7 @@ SharedNodePointer DomainGatekeeper::processAssignmentConnectRequest(const NodeCo
|
||||||
// add the new node
|
// add the new node
|
||||||
SharedNodePointer newNode = addVerifiedNodeFromConnectRequest(nodeConnection);
|
SharedNodePointer newNode = addVerifiedNodeFromConnectRequest(nodeConnection);
|
||||||
|
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(newNode->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(newNode->getLinkedData());
|
||||||
|
|
||||||
// set assignment related data on the linked data for this node
|
// set assignment related data on the linked data for this node
|
||||||
nodeData->setAssignmentUUID(matchingQueuedAssignment->getUUID());
|
nodeData->setAssignmentUUID(matchingQueuedAssignment->getUUID());
|
||||||
|
@ -458,7 +458,7 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect
|
||||||
newNode->setPermissions(userPerms);
|
newNode->setPermissions(userPerms);
|
||||||
|
|
||||||
// grab the linked data for our new node so we can set the username
|
// grab the linked data for our new node so we can set the username
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(newNode->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(newNode->getLinkedData());
|
||||||
|
|
||||||
// if we have a username from the connect request, set it on the DomainServerNodeData
|
// if we have a username from the connect request, set it on the DomainServerNodeData
|
||||||
nodeData->setUsername(username);
|
nodeData->setUsername(username);
|
||||||
|
|
|
@ -841,7 +841,7 @@ void DomainServer::processListRequestPacket(QSharedPointer<ReceivedMessage> mess
|
||||||
sendingNode->setLocalSocket(nodeRequestData.localSockAddr);
|
sendingNode->setLocalSocket(nodeRequestData.localSockAddr);
|
||||||
|
|
||||||
// update the NodeInterestSet in case there have been any changes
|
// update the NodeInterestSet in case there have been any changes
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(sendingNode->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(sendingNode->getLinkedData());
|
||||||
|
|
||||||
// guard against patched agents asking to hear about other agents
|
// guard against patched agents asking to hear about other agents
|
||||||
auto safeInterestSet = nodeRequestData.interestList.toSet();
|
auto safeInterestSet = nodeRequestData.interestList.toSet();
|
||||||
|
@ -945,7 +945,7 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif
|
||||||
// always send the node their own UUID back
|
// always send the node their own UUID back
|
||||||
QDataStream domainListStream(domainListPackets.get());
|
QDataStream domainListStream(domainListPackets.get());
|
||||||
|
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(node->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||||
|
|
||||||
// store the nodeInterestSet on this DomainServerNodeData, in case it has changed
|
// store the nodeInterestSet on this DomainServerNodeData, in case it has changed
|
||||||
auto& nodeInterestSet = nodeData->getNodeInterestSet();
|
auto& nodeInterestSet = nodeData->getNodeInterestSet();
|
||||||
|
@ -994,7 +994,7 @@ QUuid DomainServer::connectionSecretForNodes(const SharedNodePointer& nodeA, con
|
||||||
secretUUID = QUuid::createUuid();
|
secretUUID = QUuid::createUuid();
|
||||||
|
|
||||||
// set it on the other Node's sessionSecretHash
|
// set it on the other Node's sessionSecretHash
|
||||||
reinterpret_cast<DomainServerNodeData*>(nodeBData)->getSessionSecretHash().insert(nodeA->getUUID(), secretUUID);
|
static_cast<DomainServerNodeData*>(nodeBData)->getSessionSecretHash().insert(nodeA->getUUID(), secretUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return secretUUID;
|
return secretUUID;
|
||||||
|
@ -1124,7 +1124,7 @@ void DomainServer::processRequestAssignmentPacket(QSharedPointer<ReceivedMessage
|
||||||
void DomainServer::setupPendingAssignmentCredits() {
|
void DomainServer::setupPendingAssignmentCredits() {
|
||||||
// enumerate the NodeList to find the assigned nodes
|
// enumerate the NodeList to find the assigned nodes
|
||||||
DependencyManager::get<LimitedNodeList>()->eachNode([&](const SharedNodePointer& node){
|
DependencyManager::get<LimitedNodeList>()->eachNode([&](const SharedNodePointer& node){
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(node->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||||
|
|
||||||
if (!nodeData->getAssignmentUUID().isNull() && !nodeData->getWalletUUID().isNull()) {
|
if (!nodeData->getAssignmentUUID().isNull() && !nodeData->getWalletUUID().isNull()) {
|
||||||
// check if we have a non-finalized transaction for this node to add this amount to
|
// check if we have a non-finalized transaction for this node to add this amount to
|
||||||
|
@ -1556,7 +1556,7 @@ QJsonObject DomainServer::jsonObjectForNode(const SharedNodePointer& node) {
|
||||||
nodeJson[JSON_KEY_UPTIME] = QString::number(double(QDateTime::currentMSecsSinceEpoch() - node->getWakeTimestamp()) / 1000.0);
|
nodeJson[JSON_KEY_UPTIME] = QString::number(double(QDateTime::currentMSecsSinceEpoch() - node->getWakeTimestamp()) / 1000.0);
|
||||||
|
|
||||||
// if the node has pool information, add it
|
// if the node has pool information, add it
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(node->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||||
|
|
||||||
// add the node username, if it exists
|
// add the node username, if it exists
|
||||||
nodeJson[JSON_KEY_USERNAME] = nodeData->getUsername();
|
nodeJson[JSON_KEY_USERNAME] = nodeData->getUsername();
|
||||||
|
@ -1687,7 +1687,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
|
|
||||||
// enumerate the NodeList to find the assigned nodes
|
// enumerate the NodeList to find the assigned nodes
|
||||||
nodeList->eachNode([this, &assignedNodesJSON](const SharedNodePointer& node){
|
nodeList->eachNode([this, &assignedNodesJSON](const SharedNodePointer& node){
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(node->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||||
|
|
||||||
if (!nodeData->getAssignmentUUID().isNull()) {
|
if (!nodeData->getAssignmentUUID().isNull()) {
|
||||||
// add the node using the UUID as the key
|
// add the node using the UUID as the key
|
||||||
|
@ -1775,7 +1775,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
if (matchingNode) {
|
if (matchingNode) {
|
||||||
// create a QJsonDocument with the stats QJsonObject
|
// create a QJsonDocument with the stats QJsonObject
|
||||||
QJsonObject statsObject =
|
QJsonObject statsObject =
|
||||||
reinterpret_cast<DomainServerNodeData*>(matchingNode->getLinkedData())->getStatsJSONObject();
|
static_cast<DomainServerNodeData*>(matchingNode->getLinkedData())->getStatsJSONObject();
|
||||||
|
|
||||||
// add the node type to the JSON data for output purposes
|
// add the node type to the JSON data for output purposes
|
||||||
statsObject["node_type"] = NodeType::getNodeTypeName(matchingNode->getType()).toLower().replace(' ', '-');
|
statsObject["node_type"] = NodeType::getNodeTypeName(matchingNode->getType()).toLower().replace(' ', '-');
|
||||||
|
|
|
@ -725,7 +725,7 @@ void DomainServerSettingsManager::processNodeKickRequestPacket(QSharedPointer<Re
|
||||||
}
|
}
|
||||||
|
|
||||||
// potentially remove connect permissions for the MAC address and machine fingerprint
|
// potentially remove connect permissions for the MAC address and machine fingerprint
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(matchingNode->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(matchingNode->getLinkedData());
|
||||||
if (nodeData) {
|
if (nodeData) {
|
||||||
// mac address first
|
// mac address first
|
||||||
NodePermissionsKey macAddressKey(nodeData->getHardwareAddress(), 0);
|
NodePermissionsKey macAddressKey(nodeData->getHardwareAddress(), 0);
|
||||||
|
@ -807,7 +807,7 @@ void DomainServerSettingsManager::processUsernameFromIDRequestPacket(QSharedPoin
|
||||||
usernameFromIDReplyPacket->writeString(verifiedUsername);
|
usernameFromIDReplyPacket->writeString(verifiedUsername);
|
||||||
|
|
||||||
// now put in the machine fingerprint
|
// now put in the machine fingerprint
|
||||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(matchingNode->getLinkedData());
|
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(matchingNode->getLinkedData());
|
||||||
machineFingerprint = nodeData ? nodeData->getMachineFingerprint() : QUuid();
|
machineFingerprint = nodeData ? nodeData->getMachineFingerprint() : QUuid();
|
||||||
usernameFromIDReplyPacket->write(machineFingerprint.toRfc4122());
|
usernameFromIDReplyPacket->write(machineFingerprint.toRfc4122());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue