mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 08:17:35 +02:00
Merge remote-tracking branch 'upstream/master' into uber
This commit is contained in:
commit
bd2003fa01
6 changed files with 38 additions and 15 deletions
|
@ -121,12 +121,13 @@ void DomainGatekeeper::processConnectRequestPacket(QSharedPointer<ReceivedMessag
|
||||||
nodeData->setNodeInterestSet(safeInterestSet);
|
nodeData->setNodeInterestSet(safeInterestSet);
|
||||||
nodeData->setPlaceName(nodeConnection.placeName);
|
nodeData->setPlaceName(nodeConnection.placeName);
|
||||||
|
|
||||||
|
QMetaEnum metaEnum = QMetaEnum::fromType<LimitedNodeList::ConnectReason>();
|
||||||
qDebug() << "Allowed connection from node" << uuidStringWithoutCurlyBraces(node->getUUID())
|
qDebug() << "Allowed connection from node" << uuidStringWithoutCurlyBraces(node->getUUID())
|
||||||
<< "on" << message->getSenderSockAddr()
|
<< "on" << message->getSenderSockAddr()
|
||||||
<< "with MAC" << nodeConnection.hardwareAddress
|
<< "with MAC" << nodeConnection.hardwareAddress
|
||||||
<< "and machine fingerprint" << nodeConnection.machineFingerprint
|
<< "and machine fingerprint" << nodeConnection.machineFingerprint
|
||||||
<< "user" << username
|
<< "user" << username
|
||||||
<< "reason" << QString(nodeConnection.connectReason ? "SilentDomainDisconnect" : "Connect")
|
<< "reason" << QString(metaEnum.valueToKey(nodeConnection.connectReason))
|
||||||
<< "previous connection uptime" << nodeConnection.previousConnectionUpTime/USECS_PER_MSEC << "msec"
|
<< "previous connection uptime" << nodeConnection.previousConnectionUpTime/USECS_PER_MSEC << "msec"
|
||||||
<< "sysinfo" << nodeConnection.SystemInfo;
|
<< "sysinfo" << nodeConnection.SystemInfo;
|
||||||
|
|
||||||
|
|
|
@ -2498,7 +2498,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
||||||
return true;
|
return true;
|
||||||
} else if (allNodesDeleteRegex.indexIn(url.path()) != -1) {
|
} else if (allNodesDeleteRegex.indexIn(url.path()) != -1) {
|
||||||
qDebug() << "Received request to kill all nodes.";
|
qDebug() << "Received request to kill all nodes.";
|
||||||
nodeList->eraseAllNodes();
|
nodeList->eraseAllNodes(url.path());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -548,6 +548,13 @@ public:
|
||||||
return true;
|
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) {
|
if (message->message == WM_COPYDATA) {
|
||||||
COPYDATASTRUCT* pcds = (COPYDATASTRUCT*)(message->lParam);
|
COPYDATASTRUCT* pcds = (COPYDATASTRUCT*)(message->lParam);
|
||||||
QUrl url = QUrl((const char*)(pcds->lpData));
|
QUrl url = QUrl((const char*)(pcds->lpData));
|
||||||
|
@ -4164,6 +4171,13 @@ bool Application::event(QEvent* event) {
|
||||||
case QEvent::FocusOut:
|
case QEvent::FocusOut:
|
||||||
focusOutEvent(static_cast<QFocusEvent*>(event));
|
focusOutEvent(static_cast<QFocusEvent*>(event));
|
||||||
return true;
|
return true;
|
||||||
|
case QEvent::FocusIn:
|
||||||
|
{ //testing to see if we can set focus when focus is not set to root window.
|
||||||
|
_glWidget->activateWindow();
|
||||||
|
_glWidget->setFocus();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
case QEvent::TouchBegin:
|
case QEvent::TouchBegin:
|
||||||
touchBeginEvent(static_cast<QTouchEvent*>(event));
|
touchBeginEvent(static_cast<QTouchEvent*>(event));
|
||||||
event->accept();
|
event->accept();
|
||||||
|
@ -5125,7 +5139,7 @@ void Application::idle() {
|
||||||
// If the offscreen Ui has something active that is NOT the root, then assume it has keyboard focus.
|
// If the offscreen Ui has something active that is NOT the root, then assume it has keyboard focus.
|
||||||
if (offscreenUi && offscreenUi->getWindow()) {
|
if (offscreenUi && offscreenUi->getWindow()) {
|
||||||
auto activeFocusItem = offscreenUi->getWindow()->activeFocusItem();
|
auto activeFocusItem = offscreenUi->getWindow()->activeFocusItem();
|
||||||
if (_keyboardDeviceHasFocus && activeFocusItem != offscreenUi->getRootItem()) {
|
if (_keyboardDeviceHasFocus && (activeFocusItem != NULL && activeFocusItem != offscreenUi->getRootItem())) {
|
||||||
_keyboardMouseDevice->pluginFocusOutEvent();
|
_keyboardMouseDevice->pluginFocusOutEvent();
|
||||||
_keyboardDeviceHasFocus = false;
|
_keyboardDeviceHasFocus = false;
|
||||||
synthesizeKeyReleasEvents();
|
synthesizeKeyReleasEvents();
|
||||||
|
@ -8772,6 +8786,8 @@ bool Application::isThrottleRendering() const {
|
||||||
|
|
||||||
bool Application::hasFocus() const {
|
bool Application::hasFocus() const {
|
||||||
bool result = (QApplication::activeWindow() != nullptr);
|
bool result = (QApplication::activeWindow() != nullptr);
|
||||||
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
// On Windows, QWidget::activateWindow() - as called in setFocus() - makes the application's taskbar icon flash but doesn't
|
// On Windows, QWidget::activateWindow() - as called in setFocus() - makes the application's taskbar icon flash but doesn't
|
||||||
// take user focus away from their current window. So also check whether the application is the user's current foreground
|
// take user focus away from their current window. So also check whether the application is the user's current foreground
|
||||||
|
|
|
@ -584,7 +584,7 @@ SharedNodePointer LimitedNodeList::nodeWithLocalID(Node::LocalID localID) const
|
||||||
return idIter == _localIDMap.cend() ? nullptr : idIter->second;
|
return idIter == _localIDMap.cend() ? nullptr : idIter->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimitedNodeList::eraseAllNodes() {
|
void LimitedNodeList::eraseAllNodes(QString reason) {
|
||||||
std::vector<SharedNodePointer> killedNodes;
|
std::vector<SharedNodePointer> killedNodes;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -593,7 +593,7 @@ void LimitedNodeList::eraseAllNodes() {
|
||||||
QWriteLocker writeLocker(&_nodeMutex);
|
QWriteLocker writeLocker(&_nodeMutex);
|
||||||
|
|
||||||
if (_nodeHash.size() > 0) {
|
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());
|
killedNodes.reserve(_nodeHash.size());
|
||||||
for (auto& pair : _nodeHash) {
|
for (auto& pair : _nodeHash) {
|
||||||
|
@ -611,8 +611,8 @@ void LimitedNodeList::eraseAllNodes() {
|
||||||
_delayedNodeAdds.clear();
|
_delayedNodeAdds.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LimitedNodeList::reset() {
|
void LimitedNodeList::reset(QString reason) {
|
||||||
eraseAllNodes();
|
eraseAllNodes(reason);
|
||||||
|
|
||||||
// we need to make sure any socket connections are gone so wait on that here
|
// we need to make sure any socket connections are gone so wait on that here
|
||||||
_nodeSocket.clearConnections();
|
_nodeSocket.clearConnections();
|
||||||
|
@ -1258,7 +1258,7 @@ void LimitedNodeList::setLocalSocket(const HifiSockAddr& sockAddr) {
|
||||||
qCInfo(networking) << "Local socket has changed from" << _localSockAddr << "to" << sockAddr;
|
qCInfo(networking) << "Local socket has changed from" << _localSockAddr << "to" << sockAddr;
|
||||||
_localSockAddr = sockAddr;
|
_localSockAddr = sockAddr;
|
||||||
if (_hasTCPCheckedLocalSocket) { // Force a port change for NAT:
|
if (_hasTCPCheckedLocalSocket) { // Force a port change for NAT:
|
||||||
reset();
|
reset("local socket change");
|
||||||
_nodeSocket.rebind(0);
|
_nodeSocket.rebind(0);
|
||||||
_localSockAddr.setPort(_nodeSocket.localPort());
|
_localSockAddr.setPort(_nodeSocket.localPort());
|
||||||
qCInfo(networking) << "Local port changed to" << _localSockAddr.getPort();
|
qCInfo(networking) << "Local port changed to" << _localSockAddr.getPort();
|
||||||
|
|
|
@ -111,7 +111,8 @@ public:
|
||||||
|
|
||||||
enum ConnectReason : quint32 {
|
enum ConnectReason : quint32 {
|
||||||
Connect = 0,
|
Connect = 0,
|
||||||
SilentDomainDisconnect
|
SilentDomainDisconnect,
|
||||||
|
Awake
|
||||||
};
|
};
|
||||||
Q_ENUM(ConnectReason);
|
Q_ENUM(ConnectReason);
|
||||||
|
|
||||||
|
@ -347,8 +348,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void reset();
|
void reset(QString reason);
|
||||||
void eraseAllNodes();
|
void eraseAllNodes(QString reason);
|
||||||
|
|
||||||
void removeSilentNodes();
|
void removeSilentNodes();
|
||||||
|
|
||||||
|
@ -358,6 +359,7 @@ public slots:
|
||||||
virtual void sendSTUNRequest();
|
virtual void sendSTUNRequest();
|
||||||
|
|
||||||
bool killNodeWithUUID(const QUuid& nodeUUID, ConnectionID newConnectionID = NULL_CONNECTION_ID);
|
bool killNodeWithUUID(const QUuid& nodeUUID, ConnectionID newConnectionID = NULL_CONNECTION_ID);
|
||||||
|
void noteAwakening() { _connectReason = Awake; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void sampleConnectionStats();
|
void sampleConnectionStats();
|
||||||
|
|
|
@ -116,7 +116,11 @@ NodeList::NodeList(char newOwnerType, int socketListenPort, int dtlsListenPort)
|
||||||
connect(&_domainHandler, SIGNAL(connectedToDomain(QUrl)), &_keepAlivePingTimer, SLOT(start()));
|
connect(&_domainHandler, SIGNAL(connectedToDomain(QUrl)), &_keepAlivePingTimer, SLOT(start()));
|
||||||
connect(&_domainHandler, &DomainHandler::disconnectedFromDomain, &_keepAlivePingTimer, &QTimer::stop);
|
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
|
// set our sockAddrBelongsToDomainOrNode method as the connection creation filter for the udt::Socket
|
||||||
using std::placeholders::_1;
|
using std::placeholders::_1;
|
||||||
|
@ -259,8 +263,7 @@ void NodeList::reset(QString reason, bool skipDomainHandlerReset) {
|
||||||
Q_ARG(bool, skipDomainHandlerReset));
|
Q_ARG(bool, skipDomainHandlerReset));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
LimitedNodeList::reset(reason);
|
||||||
LimitedNodeList::reset();
|
|
||||||
|
|
||||||
// lock and clear our set of ignored IDs
|
// lock and clear our set of ignored IDs
|
||||||
_ignoredSetLock.lockForWrite();
|
_ignoredSetLock.lockForWrite();
|
||||||
|
@ -337,7 +340,8 @@ void NodeList::sendDomainServerCheckIn() {
|
||||||
|
|
||||||
if (!domainIsConnected) {
|
if (!domainIsConnected) {
|
||||||
auto hostname = _domainHandler.getHostname();
|
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?
|
// 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
|
// 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