mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
change waitOnChildren syntax in AC monitor
This commit is contained in:
parent
78942b0a87
commit
ba2ccc1e98
2 changed files with 14 additions and 5 deletions
|
@ -66,16 +66,16 @@ AssignmentClientMonitor::~AssignmentClientMonitor() {
|
|||
stopChildProcesses();
|
||||
}
|
||||
|
||||
void AssignmentClientMonitor::waitOnChildren(int msecs) {
|
||||
void AssignmentClientMonitor::waitOnChildren(int waitMsecs) {
|
||||
QMutableListIterator<QProcess*> i(_childProcesses);
|
||||
while (i.hasNext()) {
|
||||
QProcess* childProcess = i.next();
|
||||
|
||||
if (childProcess->state() == QProcess::NotRunning) {
|
||||
i.remove();
|
||||
} else if (msecs > 0) {
|
||||
} else if (waitMsecs > 0) {
|
||||
qDebug() << "Waiting on child process" << childProcess->processId() << "to finish.";
|
||||
bool finished = childProcess->waitForFinished(msecs);
|
||||
bool finished = childProcess->waitForFinished(waitMsecs);
|
||||
if (finished) {
|
||||
i.remove();
|
||||
}
|
||||
|
@ -191,8 +191,16 @@ void AssignmentClientMonitor::checkSpares() {
|
|||
nodeList->writeUnverifiedDatagram(diePacket, childNode);
|
||||
}
|
||||
}
|
||||
|
||||
// check if any of the previous processes have now gone down
|
||||
QMutableListIterator<QProcess*> i(_childProcesses);
|
||||
while (i.hasNext()) {
|
||||
QProcess* childProcess = i.next();
|
||||
|
||||
waitOnChildren(0);
|
||||
if (childProcess->state() == QProcess::NotRunning) {
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ public:
|
|||
quint16 assignmentServerPort);
|
||||
~AssignmentClientMonitor();
|
||||
|
||||
void waitOnChildren(int msecs);
|
||||
void stopChildProcesses();
|
||||
private slots:
|
||||
void readPendingDatagrams();
|
||||
|
@ -44,6 +43,8 @@ public slots:
|
|||
|
||||
private:
|
||||
void spawnChildClient();
|
||||
void waitOnChildren(int waitMsecs);
|
||||
|
||||
QTimer _checkSparesTimer; // every few seconds see if it need fewer or more spare children
|
||||
|
||||
const unsigned int _numAssignmentClientForks;
|
||||
|
|
Loading…
Reference in a new issue