From 8affca612095b4a7e24840a6079331fb41cc3e0c Mon Sep 17 00:00:00 2001
From: Seth Alves
Date: Tue, 3 Mar 2015 14:58:53 -0800
Subject: [PATCH 1/4] pass -t to children even if run in parent mode. monitor
(parent) only interacts with its own children
---
assignment-client/src/AssignmentClient.cpp | 12 +++++-----
assignment-client/src/AssignmentClient.h | 4 ++--
assignment-client/src/AssignmentClientApp.cpp | 12 ++++++++--
assignment-client/src/AssignmentClientApp.h | 1 +
.../src/AssignmentClientMonitor.cpp | 22 +++++++++++++++----
.../src/AssignmentClientMonitor.h | 7 ++++--
6 files changed, 42 insertions(+), 16 deletions(-)
diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp
index fba96c4967..a0da273462 100644
--- a/assignment-client/src/AssignmentClient.cpp
+++ b/assignment-client/src/AssignmentClient.cpp
@@ -40,8 +40,8 @@ SharedAssignmentPointer AssignmentClient::_currentAssignment;
int hifiSockAddrMeta = qRegisterMetaType("HifiSockAddr");
-AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool, QUuid walletUUID,
- QString assignmentServerHostname, quint16 assignmentServerPort) :
+AssignmentClient::AssignmentClient(int ppid, Assignment::Type requestAssignmentType, QString assignmentPool,
+ QUuid walletUUID, QString assignmentServerHostname, quint16 assignmentServerPort) :
_assignmentServerHostname(DEFAULT_ASSIGNMENT_SERVER_HOSTNAME),
_localASPortSharedMem(NULL),
_localACMPortSharedMem(NULL)
@@ -106,7 +106,7 @@ AssignmentClient::AssignmentClient(Assignment::Type requestAssignmentType, QStri
NetworkAccessManager::getInstance();
// Hook up a timer to send this child's status to the Monitor once per second
- setUpStatsToMonitor();
+ setUpStatsToMonitor(ppid);
}
@@ -118,13 +118,13 @@ void AssignmentClient::stopAssignmentClient() {
}
-void AssignmentClient::setUpStatsToMonitor() {
+void AssignmentClient::setUpStatsToMonitor(int ppid) {
// Figure out the address to send out stats to
quint16 localMonitorServerPort = DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT;
auto nodeList = DependencyManager::get();
- nodeList->getLocalServerPortFromSharedMemory(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY,
- _localACMPortSharedMem, localMonitorServerPort);
+ nodeList->getLocalServerPortFromSharedMemory(QString(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY) + "-" +
+ QString::number(ppid), _localACMPortSharedMem, localMonitorServerPort);
_assignmentClientMonitorSocket = HifiSockAddr(DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME, localMonitorServerPort, true);
// send a stats packet every 1 seconds
diff --git a/assignment-client/src/AssignmentClient.h b/assignment-client/src/AssignmentClient.h
index d1d93c78dc..08673ab04c 100644
--- a/assignment-client/src/AssignmentClient.h
+++ b/assignment-client/src/AssignmentClient.h
@@ -22,7 +22,7 @@ class AssignmentClient : public QObject {
Q_OBJECT
public:
- AssignmentClient(Assignment::Type requestAssignmentType, QString assignmentPool,
+ AssignmentClient(int ppid, Assignment::Type requestAssignmentType, QString assignmentPool,
QUuid walletUUID, QString assignmentServerHostname, quint16 assignmentServerPort);
static const SharedAssignmentPointer& getCurrentAssignment() { return _currentAssignment; }
@@ -35,7 +35,7 @@ private slots:
void stopAssignmentClient();
private:
- void setUpStatsToMonitor();
+ void setUpStatsToMonitor(int ppid);
Assignment _requestAssignment;
static SharedAssignmentPointer _currentAssignment;
QString _assignmentServerHostname;
diff --git a/assignment-client/src/AssignmentClientApp.cpp b/assignment-client/src/AssignmentClientApp.cpp
index cfb77c8542..17f2eac70d 100644
--- a/assignment-client/src/AssignmentClientApp.cpp
+++ b/assignment-client/src/AssignmentClientApp.cpp
@@ -78,6 +78,9 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
const QCommandLineOption maxChildsOption(ASSIGNMENT_MAX_FORKS_OPTION, "maximum number of children", "child-count");
parser.addOption(maxChildsOption);
+ const QCommandLineOption ppidOption(PARENT_PID_OPTION, "parent's process id", "pid");
+ parser.addOption(ppidOption);
+
if (!parser.parse(QCoreApplication::arguments())) {
qCritical() << parser.errorText() << endl;
@@ -109,6 +112,11 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
maxForks = parser.value(maxChildsOption).toInt();
}
+ int ppid = 0;
+ if (parser.isSet(ppidOption)) {
+ ppid = parser.value(ppidOption).toInt();
+ }
+
if (!numForks && minForks) {
// if the user specified --min but not -n, set -n to --min
numForks = minForks;
@@ -174,11 +182,11 @@ AssignmentClientApp::AssignmentClientApp(int argc, char* argv[]) :
if (numForks || minForks || maxForks) {
- AssignmentClientMonitor monitor(numForks, minForks, maxForks, assignmentPool,
+ AssignmentClientMonitor monitor(numForks, minForks, maxForks, requestAssignmentType, assignmentPool,
walletUUID, assignmentServerHostname, assignmentServerPort);
exec();
} else {
- AssignmentClient client(requestAssignmentType, assignmentPool,
+ AssignmentClient client(ppid, requestAssignmentType, assignmentPool,
walletUUID, assignmentServerHostname, assignmentServerPort);
exec();
}
diff --git a/assignment-client/src/AssignmentClientApp.h b/assignment-client/src/AssignmentClientApp.h
index 531035ef0e..7f75f63755 100644
--- a/assignment-client/src/AssignmentClientApp.h
+++ b/assignment-client/src/AssignmentClientApp.h
@@ -23,6 +23,7 @@ const QString CUSTOM_ASSIGNMENT_SERVER_PORT_OPTION = "p";
const QString ASSIGNMENT_NUM_FORKS_OPTION = "n";
const QString ASSIGNMENT_MIN_FORKS_OPTION = "min";
const QString ASSIGNMENT_MAX_FORKS_OPTION = "max";
+const QString PARENT_PID_OPTION = "ppid";
class AssignmentClientApp : public QCoreApplication {
diff --git a/assignment-client/src/AssignmentClientMonitor.cpp b/assignment-client/src/AssignmentClientMonitor.cpp
index a315fce1a9..1280b55b12 100644
--- a/assignment-client/src/AssignmentClientMonitor.cpp
+++ b/assignment-client/src/AssignmentClientMonitor.cpp
@@ -20,23 +20,26 @@
#include "PacketHeaders.h"
#include "SharedUtil.h"
-const char* NUM_FORKS_PARAMETER = "-n";
const QString ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME = "assignment-client-monitor";
AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmentClientForks,
const unsigned int minAssignmentClientForks,
const unsigned int maxAssignmentClientForks,
- QString assignmentPool, QUuid walletUUID, QString assignmentServerHostname,
+ Assignment::Type requestAssignmentType, QString assignmentPool,
+ QUuid walletUUID, QString assignmentServerHostname,
quint16 assignmentServerPort) :
_numAssignmentClientForks(numAssignmentClientForks),
_minAssignmentClientForks(minAssignmentClientForks),
_maxAssignmentClientForks(maxAssignmentClientForks),
+ _requestAssignmentType(requestAssignmentType),
_assignmentPool(assignmentPool),
_walletUUID(walletUUID),
_assignmentServerHostname(assignmentServerHostname),
_assignmentServerPort(assignmentServerPort)
{
+ qDebug() << "_requestAssignmentType =" << _requestAssignmentType;
+
// start the Logging class with the parent's target name
LogHandler::getInstance().setTargetName(ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME);
@@ -47,8 +50,10 @@ AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmen
connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &AssignmentClientMonitor::readPendingDatagrams);
- nodeList->putLocalPortIntoSharedMemory(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY, this,
- nodeList->getNodeSocket().localPort());
+ qint64 pid = QCoreApplication::applicationPid ();
+
+ nodeList->putLocalPortIntoSharedMemory(QString(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY) + "-" + QString::number(pid),
+ this, nodeList->getNodeSocket().localPort());
// use QProcess to fork off a process for each of the child assignment clients
for (unsigned int i = 0; i < _numAssignmentClientForks; i++) {
@@ -96,6 +101,15 @@ void AssignmentClientMonitor::spawnChildClient() {
_childArguments.append("--" + CUSTOM_ASSIGNMENT_SERVER_PORT_OPTION);
_childArguments.append(QString::number(_assignmentServerPort));
}
+ if (_requestAssignmentType != Assignment::AllTypes) {
+ _childArguments.append("--" + ASSIGNMENT_TYPE_OVERRIDE_OPTION);
+ _childArguments.append(QString::number(_requestAssignmentType));
+ }
+
+ // tell children which shared memory key to use
+ qint64 pid = QCoreApplication::applicationPid ();
+ _childArguments.append("--" + PARENT_PID_OPTION);
+ _childArguments.append(QString::number(pid));
// make sure that the output from the child process appears in our output
assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels);
diff --git a/assignment-client/src/AssignmentClientMonitor.h b/assignment-client/src/AssignmentClientMonitor.h
index dc88bfcd95..996220b1b4 100644
--- a/assignment-client/src/AssignmentClientMonitor.h
+++ b/assignment-client/src/AssignmentClientMonitor.h
@@ -28,8 +28,9 @@ class AssignmentClientMonitor : public QObject {
Q_OBJECT
public:
AssignmentClientMonitor(const unsigned int numAssignmentClientForks, const unsigned int minAssignmentClientForks,
- const unsigned int maxAssignmentClientForks, QString assignmentPool, QUuid walletUUID,
- QString assignmentServerHostname, quint16 assignmentServerPort);
+ const unsigned int maxAssignmentClientForks, Assignment::Type requestAssignmentType,
+ QString assignmentPool, QUuid walletUUID, QString assignmentServerHostname,
+ quint16 assignmentServerPort);
~AssignmentClientMonitor();
void stopChildProcesses();
@@ -45,10 +46,12 @@ private:
const unsigned int _minAssignmentClientForks;
const unsigned int _maxAssignmentClientForks;
+ Assignment::Type _requestAssignmentType;
QString _assignmentPool;
QUuid _walletUUID;
QString _assignmentServerHostname;
quint16 _assignmentServerPort;
+
};
#endif // hifi_AssignmentClientMonitor_h
From 299035bc85b9a10a42c9494b82d21b70f6a27a58 Mon Sep 17 00:00:00 2001
From: Ryan Huffman
Date: Thu, 5 Mar 2015 15:05:17 -0800
Subject: [PATCH 2/4] Move script editor show() call to DialogsManager
---
interface/src/ui/DialogsManager.cpp | 1 +
interface/src/ui/ScriptEditorWindow.cpp | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/interface/src/ui/DialogsManager.cpp b/interface/src/ui/DialogsManager.cpp
index 752e205a6a..43f2e00421 100644
--- a/interface/src/ui/DialogsManager.cpp
+++ b/interface/src/ui/DialogsManager.cpp
@@ -160,6 +160,7 @@ void DialogsManager::showMetavoxelNetworkSimulator() {
void DialogsManager::showScriptEditor() {
maybeCreateDialog(_scriptEditor);
+ _scriptEditor->show();
_scriptEditor->raise();
}
diff --git a/interface/src/ui/ScriptEditorWindow.cpp b/interface/src/ui/ScriptEditorWindow.cpp
index 835dab6657..858f26f843 100644
--- a/interface/src/ui/ScriptEditorWindow.cpp
+++ b/interface/src/ui/ScriptEditorWindow.cpp
@@ -41,7 +41,6 @@ ScriptEditorWindow::ScriptEditorWindow(QWidget* parent) :
_ScriptEditorWindowUI->setupUi(this);
this->setWindowFlags(Qt::Tool);
- show();
addScriptEditorWidget("New script");
connect(_loadMenu, &QMenu::aboutToShow, this, &ScriptEditorWindow::loadMenuAboutToShow);
_ScriptEditorWindowUI->loadButton->setMenu(_loadMenu);
From b3631de93c4564e6b53d01acc56819941e0db5a1 Mon Sep 17 00:00:00 2001
From: Ryan Huffman
Date: Fri, 6 Mar 2015 12:03:36 -0800
Subject: [PATCH 3/4] Remove print statements from entityList.js
---
examples/libraries/entityList.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/examples/libraries/entityList.js b/examples/libraries/entityList.js
index 8fbc40698f..942edf18b6 100644
--- a/examples/libraries/entityList.js
+++ b/examples/libraries/entityList.js
@@ -28,7 +28,6 @@ EntityListTool = function(opts) {
type: 'selectionUpdate',
selectedIDs: selectedIDs,
};
- print("Sending: " + JSON.stringify(data));
webView.eventBridge.emitScriptEvent(JSON.stringify(data));
});
@@ -59,7 +58,6 @@ EntityListTool = function(opts) {
}
webView.eventBridge.webEventReceived.connect(function(data) {
- print("Got: " + data);
data = JSON.parse(data);
if (data.type == "selectionUpdate") {
var ids = data.entityIds;
From 7c78e598b84c1cae1f7d346498effd2a83258ffb Mon Sep 17 00:00:00 2001
From: Grayson Stebbins
Date: Fri, 6 Mar 2015 15:15:48 -0800
Subject: [PATCH 4/4] Update to .com instead of .io in Welcome dialog
---
interface/resources/html/interface-welcome.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/interface/resources/html/interface-welcome.html b/interface/resources/html/interface-welcome.html
index d632cb0e5c..ed905eb392 100644
--- a/interface/resources/html/interface-welcome.html
+++ b/interface/resources/html/interface-welcome.html
@@ -154,7 +154,7 @@
devour all we've written and make
suggestions where necessary.
Documentation is always at
- docs.highfidelity.io
+ docs.highfidelity.com
@@ -187,4 +187,4 @@
}
-