Showing the changes to assignment-client/src/AssignmentClientMonitor.cpp (1 of 6 files). Show all
Unified · Split
| @@ -20,23 +20,26 @@ · 19 unmodified lines | ||
| 20 | 20 | #include "PacketHeaders.h" |
| 21 | 21 | #include "SharedUtil.h" |
| 22 | 22 | |
| 23 | −const char* NUM_FORKS_PARAMETER = "-n"; | |
| 24 | 23 | |
| 25 | 24 | const QString ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME = "assignment-client-monitor"; |
| 26 | 25 | |
| 27 | 26 | AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmentClientForks, |
| 28 | 27 | const unsigned int minAssignmentClientForks, |
| 29 | 28 | const unsigned int maxAssignmentClientForks, |
| 30 | − QString assignmentPool, QUuid walletUUID, QString assignmentServerHostname, | |
| 29 | + Assignment::Type requestAssignmentType, QString assignmentPool, | |
| 30 | + QUuid walletUUID, QString assignmentServerHostname, | |
| 31 | 31 | quint16 assignmentServerPort) : |
| 32 | 32 | _numAssignmentClientForks(numAssignmentClientForks), |
| 33 | 33 | _minAssignmentClientForks(minAssignmentClientForks), |
| 34 | 34 | _maxAssignmentClientForks(maxAssignmentClientForks), |
| 35 | + _requestAssignmentType(requestAssignmentType), | |
| 35 | 36 | _assignmentPool(assignmentPool), |
| 36 | 37 | _walletUUID(walletUUID), |
| 37 | 38 | _assignmentServerHostname(assignmentServerHostname), |
| 38 | 39 | _assignmentServerPort(assignmentServerPort) |
| 39 | 40 | { |
| 41 | + qDebug() << "_requestAssignmentType =" << _requestAssignmentType; | |
| 42 | + | |
| 40 | 43 | // start the Logging class with the parent's target name |
| 41 | 44 | LogHandler::getInstance().setTargetName(ASSIGNMENT_CLIENT_MONITOR_TARGET_NAME); |
| 42 | 45 | |
| @@ -47,8 +50,10 @@ AssignmentClientMonitor::AssignmentClientMonitor(const unsigned int numAssignmen · 4 unmodified lines | ||
| 47 | 50 | |
| 48 | 51 | connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &AssignmentClientMonitor::readPendingDatagrams); |
| 49 | 52 | |
| 50 | − nodeList->putLocalPortIntoSharedMemory(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY, this, | |
| 51 | − nodeList->getNodeSocket().localPort()); | |
| 53 | + qint64 pid = QCoreApplication::applicationPid (); | |
| 54 | + | |
| 55 | + nodeList->putLocalPortIntoSharedMemory(QString(ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY) + "-" + QString::number(pid), | |
| 56 | + this, nodeList->getNodeSocket().localPort()); | |
| 52 | 57 | |
| 53 | 58 | // use QProcess to fork off a process for each of the child assignment clients |
| 54 | 59 | for (unsigned int i = 0; i < _numAssignmentClientForks; i++) { |
| @@ -96,6 +101,15 @@ void AssignmentClientMonitor::spawnChildClient() { · 41 unmodified lines | ||
| 96 | 101 | _childArguments.append("--" + CUSTOM_ASSIGNMENT_SERVER_PORT_OPTION); |
| 97 | 102 | _childArguments.append(QString::number(_assignmentServerPort)); |
| 98 | 103 | } |
| 104 | + if (_requestAssignmentType != Assignment::AllTypes) { | |
| 105 | + _childArguments.append("--" + ASSIGNMENT_TYPE_OVERRIDE_OPTION); | |
| 106 | + _childArguments.append(QString::number(_requestAssignmentType)); | |
| 107 | + } | |
| 108 | + | |
| 109 | + // tell children which shared memory key to use | |
| 110 | + qint64 pid = QCoreApplication::applicationPid (); | |
| 111 | + _childArguments.append("--" + PARENT_PID_OPTION); | |
| 112 | + _childArguments.append(QString::number(pid)); | |
| 99 | 113 | |
| 100 | 114 | // make sure that the output from the child process appears in our output |
| 101 | 115 | assignmentClient->setProcessChannelMode(QProcess::ForwardedChannels); |