mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 23:12:36 +02:00
log wakeup (on client and report to DS) during connection on Windows
This commit is contained in:
parent
31582cf857
commit
335119cb58
6 changed files with 28 additions and 14 deletions
|
@ -121,12 +121,13 @@ void DomainGatekeeper::processConnectRequestPacket(QSharedPointer<ReceivedMessag
|
|||
nodeData->setNodeInterestSet(safeInterestSet);
|
||||
nodeData->setPlaceName(nodeConnection.placeName);
|
||||
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<LimitedNodeList::ConnectReason>();
|
||||
qDebug() << "Allowed connection from node" << uuidStringWithoutCurlyBraces(node->getUUID())
|
||||
<< "on" << message->getSenderSockAddr()
|
||||
<< "with MAC" << nodeConnection.hardwareAddress
|
||||
<< "and machine fingerprint" << nodeConnection.machineFingerprint
|
||||
<< "user" << username
|
||||
<< "reason" << QString(nodeConnection.connectReason ? "SilentDomainDisconnect" : "Connect")
|
||||
<< "reason" << QString(metaEnum.valueToKey(nodeConnection.connectReason))
|
||||
<< "previous connection uptime" << nodeConnection.previousConnectionUpTime/USECS_PER_MSEC << "msec"
|
||||
<< "sysinfo" << nodeConnection.SystemInfo;
|
||||
|
||||
|
|
|
@ -2498,7 +2498,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
|||
return true;
|
||||
} else if (allNodesDeleteRegex.indexIn(url.path()) != -1) {
|
||||
qDebug() << "Received request to kill all nodes.";
|
||||
nodeList->eraseAllNodes();
|
||||
nodeList->eraseAllNodes(url.path());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -548,6 +548,13 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
if (message->message == WM_POWERBROADCAST) {
|
||||
if (message->wParam == PBT_APMRESUMEAUTOMATIC) {
|
||||
qCInfo(interfaceapp) << "Waking up from sleep or hybernation.";
|
||||
QMetaObject::invokeMethod(DependencyManager::get<NodeList>().data(), "noteAwakening", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
if (message->message == WM_COPYDATA) {
|
||||
COPYDATASTRUCT* pcds = (COPYDATASTRUCT*)(message->lParam);
|
||||
QUrl url = QUrl((const char*)(pcds->lpData));
|
||||
|
|
|
@ -584,7 +584,7 @@ SharedNodePointer LimitedNodeList::nodeWithLocalID(Node::LocalID localID) const
|
|||
return idIter == _localIDMap.cend() ? nullptr : idIter->second;
|
||||
}
|
||||
|
||||
void LimitedNodeList::eraseAllNodes() {
|
||||
void LimitedNodeList::eraseAllNodes(QString reason) {
|
||||
std::vector<SharedNodePointer> killedNodes;
|
||||
|
||||
{
|
||||
|
@ -593,7 +593,7 @@ void LimitedNodeList::eraseAllNodes() {
|
|||
QWriteLocker writeLocker(&_nodeMutex);
|
||||
|
||||
if (_nodeHash.size() > 0) {
|
||||
qCDebug(networking) << "LimitedNodeList::eraseAllNodes() removing all nodes from NodeList.";
|
||||
qCDebug(networking) << "LimitedNodeList::eraseAllNodes() removing all nodes from NodeList:" << reason;
|
||||
|
||||
killedNodes.reserve(_nodeHash.size());
|
||||
for (auto& pair : _nodeHash) {
|
||||
|
@ -611,8 +611,8 @@ void LimitedNodeList::eraseAllNodes() {
|
|||
_delayedNodeAdds.clear();
|
||||
}
|
||||
|
||||
void LimitedNodeList::reset() {
|
||||
eraseAllNodes();
|
||||
void LimitedNodeList::reset(QString reason) {
|
||||
eraseAllNodes(reason);
|
||||
|
||||
// we need to make sure any socket connections are gone so wait on that here
|
||||
_nodeSocket.clearConnections();
|
||||
|
@ -1258,7 +1258,7 @@ void LimitedNodeList::setLocalSocket(const HifiSockAddr& sockAddr) {
|
|||
qCInfo(networking) << "Local socket has changed from" << _localSockAddr << "to" << sockAddr;
|
||||
_localSockAddr = sockAddr;
|
||||
if (_hasTCPCheckedLocalSocket) { // Force a port change for NAT:
|
||||
reset();
|
||||
reset("local socket change");
|
||||
_nodeSocket.rebind(0);
|
||||
_localSockAddr.setPort(_nodeSocket.localPort());
|
||||
qCInfo(networking) << "Local port changed to" << _localSockAddr.getPort();
|
||||
|
|
|
@ -111,7 +111,8 @@ public:
|
|||
|
||||
enum ConnectReason : quint32 {
|
||||
Connect = 0,
|
||||
SilentDomainDisconnect
|
||||
SilentDomainDisconnect,
|
||||
Awake
|
||||
};
|
||||
Q_ENUM(ConnectReason);
|
||||
|
||||
|
@ -347,8 +348,8 @@ public:
|
|||
};
|
||||
|
||||
public slots:
|
||||
void reset();
|
||||
void eraseAllNodes();
|
||||
void reset(QString reason);
|
||||
void eraseAllNodes(QString reason);
|
||||
|
||||
void removeSilentNodes();
|
||||
|
||||
|
@ -358,6 +359,7 @@ public slots:
|
|||
virtual void sendSTUNRequest();
|
||||
|
||||
bool killNodeWithUUID(const QUuid& nodeUUID, ConnectionID newConnectionID = NULL_CONNECTION_ID);
|
||||
void noteAwakening() { _connectReason = Awake; }
|
||||
|
||||
private slots:
|
||||
void sampleConnectionStats();
|
||||
|
|
|
@ -116,7 +116,11 @@ NodeList::NodeList(char newOwnerType, int socketListenPort, int dtlsListenPort)
|
|||
connect(&_domainHandler, SIGNAL(connectedToDomain(QUrl)), &_keepAlivePingTimer, SLOT(start()));
|
||||
connect(&_domainHandler, &DomainHandler::disconnectedFromDomain, &_keepAlivePingTimer, &QTimer::stop);
|
||||
|
||||
connect(&_domainHandler, &DomainHandler::limitOfSilentDomainCheckInsReached, this, [this]() { _connectReason = LimitedNodeList::SilentDomainDisconnect; });
|
||||
connect(&_domainHandler, &DomainHandler::limitOfSilentDomainCheckInsReached, this, [this]() {
|
||||
if (_connectReason != Awake) {
|
||||
_connectReason = SilentDomainDisconnect;
|
||||
}
|
||||
});
|
||||
|
||||
// set our sockAddrBelongsToDomainOrNode method as the connection creation filter for the udt::Socket
|
||||
using std::placeholders::_1;
|
||||
|
@ -259,8 +263,7 @@ void NodeList::reset(QString reason, bool skipDomainHandlerReset) {
|
|||
Q_ARG(bool, skipDomainHandlerReset));
|
||||
return;
|
||||
}
|
||||
|
||||
LimitedNodeList::reset();
|
||||
LimitedNodeList::reset(reason);
|
||||
|
||||
// lock and clear our set of ignored IDs
|
||||
_ignoredSetLock.lockForWrite();
|
||||
|
@ -337,7 +340,8 @@ void NodeList::sendDomainServerCheckIn() {
|
|||
|
||||
if (!domainIsConnected) {
|
||||
auto hostname = _domainHandler.getHostname();
|
||||
qCDebug(networking_ice) << "Sending connect request to domain-server at" << hostname;
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<LimitedNodeList::ConnectReason>();
|
||||
qCDebug(networking_ice) << "Sending connect request ( REASON:" << QString(metaEnum.valueToKey(_connectReason)) << ") to domain-server at" << hostname;
|
||||
|
||||
// is this our localhost domain-server?
|
||||
// if so we need to make sure we have an up-to-date local port in case it restarted
|
||||
|
|
Loading…
Reference in a new issue