Revert "Merge pull request #15620 from highfidelity/revert-15612-domaincheckin"

This reverts commit 4735b9f19a, reversing
changes made to bc4a88beb7.
This commit is contained in:
Roxanne Skelly 2019-05-23 11:00:43 -07:00
parent 4735b9f19a
commit 4f1eeecc2f
8 changed files with 77 additions and 34 deletions

View file

@ -358,7 +358,7 @@ SharedNodePointer DomainGatekeeper::processAssignmentConnectRequest(const NodeCo
nodeData->setNodeVersion(it->second.getNodeVersion()); nodeData->setNodeVersion(it->second.getNodeVersion());
nodeData->setHardwareAddress(nodeConnection.hardwareAddress); nodeData->setHardwareAddress(nodeConnection.hardwareAddress);
nodeData->setMachineFingerprint(nodeConnection.machineFingerprint); nodeData->setMachineFingerprint(nodeConnection.machineFingerprint);
nodeData->setLastDomainCheckinTimestamp(nodeConnection.lastPingTimestamp);
nodeData->setWasAssigned(true); nodeData->setWasAssigned(true);
// cleanup the PendingAssignedNodeData for this assignment now that it's connecting // cleanup the PendingAssignedNodeData for this assignment now that it's connecting
@ -499,6 +499,9 @@ SharedNodePointer DomainGatekeeper::processAgentConnectRequest(const NodeConnect
// set the machine fingerprint passed in the connect request // set the machine fingerprint passed in the connect request
nodeData->setMachineFingerprint(nodeConnection.machineFingerprint); nodeData->setMachineFingerprint(nodeConnection.machineFingerprint);
// set the last ping timestamp passed in the connect request
nodeData->setLastDomainCheckinTimestamp(nodeConnection.lastPingTimestamp);
// also add an interpolation to DomainServerNodeData so that servers can get username in stats // also add an interpolation to DomainServerNodeData so that servers can get username in stats
nodeData->addOverrideForKey(USERNAME_UUID_REPLACEMENT_STATS_KEY, nodeData->addOverrideForKey(USERNAME_UUID_REPLACEMENT_STATS_KEY,
uuidStringWithoutCurlyBraces(newNode->getUUID()), username); uuidStringWithoutCurlyBraces(newNode->getUUID()), username);

View file

@ -1068,6 +1068,8 @@ void DomainServer::processListRequestPacket(QSharedPointer<ReceivedMessage> mess
// update the connecting hostname in case it has changed // update the connecting hostname in case it has changed
nodeData->setPlaceName(nodeRequestData.placeName); nodeData->setPlaceName(nodeRequestData.placeName);
nodeData->setLastDomainCheckinTimestamp(nodeRequestData.lastPingTimestamp);
sendDomainListToNode(sendingNode, message->getSenderSockAddr()); sendDomainListToNode(sendingNode, message->getSenderSockAddr());
} }
@ -1174,6 +1176,10 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif
DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(node->getLinkedData()); DomainServerNodeData* nodeData = static_cast<DomainServerNodeData*>(node->getLinkedData());
domainListStream << nodeData->getLastDomainCheckinTimestamp();
domainListStream << usecTimestampNow();
// 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();

View file

@ -61,6 +61,9 @@ public:
void setMachineFingerprint(const QUuid& machineFingerprint) { _machineFingerprint = machineFingerprint; } void setMachineFingerprint(const QUuid& machineFingerprint) { _machineFingerprint = machineFingerprint; }
const QUuid& getMachineFingerprint() { return _machineFingerprint; } const QUuid& getMachineFingerprint() { return _machineFingerprint; }
void setLastDomainCheckinTimestamp(quint64 lastDomainCheckinTimestamp) { _lastDomainCheckinTimestamp = lastDomainCheckinTimestamp; }
quint64 getLastDomainCheckinTimestamp() { return _lastDomainCheckinTimestamp; }
void addOverrideForKey(const QString& key, const QString& value, const QString& overrideValue); void addOverrideForKey(const QString& key, const QString& value, const QString& overrideValue);
void removeOverrideForKey(const QString& key, const QString& value); void removeOverrideForKey(const QString& key, const QString& value);
@ -93,7 +96,7 @@ private:
QString _nodeVersion; QString _nodeVersion;
QString _hardwareAddress; QString _hardwareAddress;
QUuid _machineFingerprint; QUuid _machineFingerprint;
quint64 _lastDomainCheckinTimestamp;
QString _placeName; QString _placeName;
bool _wasAssigned { false }; bool _wasAssigned { false };

View file

@ -36,6 +36,8 @@ NodeConnectionData NodeConnectionData::fromDataStream(QDataStream& dataStream, c
// now the machine fingerprint // now the machine fingerprint
dataStream >> newHeader.machineFingerprint; dataStream >> newHeader.machineFingerprint;
} }
dataStream >> newHeader.lastPingTimestamp;
dataStream >> newHeader.nodeType dataStream >> newHeader.nodeType
>> newHeader.publicSockAddr >> newHeader.localSockAddr >> newHeader.publicSockAddr >> newHeader.localSockAddr

View file

@ -22,6 +22,7 @@ public:
bool isConnectRequest = true); bool isConnectRequest = true);
QUuid connectUUID; QUuid connectUUID;
quint64 lastPingTimestamp{ 0 };
NodeType_t nodeType; NodeType_t nodeType;
HifiSockAddr publicSockAddr; HifiSockAddr publicSockAddr;
HifiSockAddr localSockAddr; HifiSockAddr localSockAddr;

View file

@ -412,6 +412,8 @@ void NodeList::sendDomainServerCheckIn() {
packetStream << FingerprintUtils::getMachineFingerprint(); packetStream << FingerprintUtils::getMachineFingerprint();
} }
packetStream << usecTimestampNow();
// pack our data to send to the domain-server including // pack our data to send to the domain-server including
// the hostname information (so the domain-server can see which place name we came in on) // the hostname information (so the domain-server can see which place name we came in on)
packetStream << _ownerType.load() << publicSockAddr << localSockAddr << _nodeTypesOfInterest.toList(); packetStream << _ownerType.load() << publicSockAddr << localSockAddr << _nodeTypesOfInterest.toList();
@ -618,32 +620,14 @@ void NodeList::processDomainServerConnectionTokenPacket(QSharedPointer<ReceivedM
} }
void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message) { void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message) {
if (_domainHandler.getSockAddr().isNull()) {
qWarning() << "IGNORING DomainList packet while not connected to a Domain Server";
// refuse to process this packet if we aren't currently connected to the DS
return;
}
// this is a packet from the domain server, reset the count of un-replied check-ins
_domainHandler.clearPendingCheckins();
// emit our signal so listeners know we just heard from the DS
emit receivedDomainServerList();
DependencyManager::get<NodeList>()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::ReceiveDSList);
// parse header information
QDataStream packetStream(message->getMessage()); QDataStream packetStream(message->getMessage());
// grab the domain's ID from the beginning of the packet // grab the domain's ID from the beginning of the packet
QUuid domainUUID; QUuid domainUUID;
packetStream >> domainUUID; packetStream >> domainUUID;
if (_domainHandler.isConnected() && _domainHandler.getUUID() != domainUUID) {
// Recieved packet from different domain.
qWarning() << "IGNORING DomainList packet from" << domainUUID << "while connected to" << _domainHandler.getUUID();
return;
}
Node::LocalID domainLocalID; Node::LocalID domainLocalID;
packetStream >> domainLocalID; packetStream >> domainLocalID;
@ -654,6 +638,57 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
packetStream >> newUUID; packetStream >> newUUID;
packetStream >> newLocalID; packetStream >> newLocalID;
// pull the permissions/right/privileges for this node out of the stream
NodePermissions newPermissions;
packetStream >> newPermissions;
setPermissions(newPermissions);
// Is packet authentication enabled?
bool isAuthenticated;
packetStream >> isAuthenticated;
setAuthenticatePackets(isAuthenticated);
quint64 connectRequestTimestamp;
quint64 now = usecTimestampNow();
packetStream >> connectRequestTimestamp;
quint64 pingLagTime = (now - connectRequestTimestamp) / USECS_PER_MSEC;
quint64 domainServerPingReceiveTime;
packetStream >> domainServerPingReceiveTime;
quint64 domainServerRequestLag = (domainServerPingReceiveTime - connectRequestTimestamp) / USECS_PER_MSEC;
quint64 domainServerResponseLag = (now - domainServerPingReceiveTime) / USECS_PER_MSEC;
if (_domainHandler.getSockAddr().isNull()) {
qWarning(networking) << "IGNORING DomainList packet while not connected to a Domain Server: sent " << pingLagTime << " msec ago.";
qWarning(networking) << "DomainList request lag (with skew): " << domainServerRequestLag << "msec";
qWarning(networking) << "DomainList response lag (with skew): " << domainServerResponseLag << "msec";
// refuse to process this packet if we aren't currently connected to the DS
return;
}
// warn if ping lag is getting long
if (pingLagTime > MSECS_PER_SECOND) {
qCDebug(networking) << "DomainList ping is lagging: " << pingLagTime << "msec";
qCDebug(networking) << "DomainList request lag (with skew): " << domainServerRequestLag << "msec";
qCDebug(networking) << "DomainList response lag (with skew): " << domainServerResponseLag << "msec";
}
// this is a packet from the domain server, reset the count of un-replied check-ins
_domainHandler.clearPendingCheckins();
// emit our signal so listeners know we just heard from the DS
emit receivedDomainServerList();
DependencyManager::get<NodeList>()->flagTimeForConnectionStep(LimitedNodeList::ConnectionStep::ReceiveDSList);
if (_domainHandler.isConnected() && _domainHandler.getUUID() != domainUUID) {
// Recieved packet from different domain.
qWarning() << "IGNORING DomainList packet from" << domainUUID << "while connected to"
<< _domainHandler.getUUID() << ": sent " << pingLagTime << " msec ago.";
qWarning(networking) << "DomainList request lag (with skew): " << domainServerRequestLag << "msec";
qWarning(networking) << "DomainList response lag (with skew): " << domainServerResponseLag << "msec";
return;
}
// when connected, if the session ID or local ID were not null and changed, we should reset // when connected, if the session ID or local ID were not null and changed, we should reset
auto currentLocalID = getSessionLocalID(); auto currentLocalID = getSessionLocalID();
auto currentSessionID = getSessionUUID(); auto currentSessionID = getSessionUUID();
@ -684,15 +719,6 @@ void NodeList::processDomainServerList(QSharedPointer<ReceivedMessage> message)
DependencyManager::get<AddressManager>()->lookupShareableNameForDomainID(domainUUID); DependencyManager::get<AddressManager>()->lookupShareableNameForDomainID(domainUUID);
} }
// pull the permissions/right/privileges for this node out of the stream
NodePermissions newPermissions;
packetStream >> newPermissions;
setPermissions(newPermissions);
// Is packet authentication enabled?
bool isAuthenticated;
packetStream >> isAuthenticated;
setAuthenticatePackets(isAuthenticated);
// pull each node in the packet // pull each node in the packet
while (packetStream.device()->pos() < message->getSize()) { while (packetStream.device()->pos() < message->getSize()) {
parseNodeFromPacketStream(packetStream); parseNodeFromPacketStream(packetStream);

View file

@ -27,7 +27,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
case PacketType::StunResponse: case PacketType::StunResponse:
return 17; return 17;
case PacketType::DomainList: case PacketType::DomainList:
return static_cast<PacketVersion>(DomainListVersion::AuthenticationOptional); return static_cast<PacketVersion>(DomainListVersion::HasTimestamp);
case PacketType::EntityAdd: case PacketType::EntityAdd:
case PacketType::EntityClone: case PacketType::EntityClone:
case PacketType::EntityEdit: case PacketType::EntityEdit:
@ -72,7 +72,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
return static_cast<PacketVersion>(DomainConnectionDeniedVersion::IncludesExtraInfo); return static_cast<PacketVersion>(DomainConnectionDeniedVersion::IncludesExtraInfo);
case PacketType::DomainConnectRequest: case PacketType::DomainConnectRequest:
return static_cast<PacketVersion>(DomainConnectRequestVersion::AlwaysHasMachineFingerprint); return static_cast<PacketVersion>(DomainConnectRequestVersion::HasTimestamp);
case PacketType::DomainServerAddedNode: case PacketType::DomainServerAddedNode:
return static_cast<PacketVersion>(DomainServerAddedNodeVersion::PermissionsGrid); return static_cast<PacketVersion>(DomainServerAddedNodeVersion::PermissionsGrid);

View file

@ -344,7 +344,8 @@ enum class DomainConnectRequestVersion : PacketVersion {
HasProtocolVersions, HasProtocolVersions,
HasMACAddress, HasMACAddress,
HasMachineFingerprint, HasMachineFingerprint,
AlwaysHasMachineFingerprint AlwaysHasMachineFingerprint,
HasTimestamp
}; };
enum class DomainConnectionDeniedVersion : PacketVersion { enum class DomainConnectionDeniedVersion : PacketVersion {
@ -363,7 +364,8 @@ enum class DomainListVersion : PacketVersion {
PermissionsGrid, PermissionsGrid,
GetUsernameFromUUIDSupport, GetUsernameFromUUIDSupport,
GetMachineFingerprintFromUUIDSupport, GetMachineFingerprintFromUUIDSupport,
AuthenticationOptional AuthenticationOptional,
HasTimestamp
}; };
enum class AudioVersion : PacketVersion { enum class AudioVersion : PacketVersion {