mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
allow client count to drift as needed if the user doesn't specify --min or --max
This commit is contained in:
parent
0c28e220d1
commit
5c5ffc07ab
1 changed files with 15 additions and 9 deletions
|
@ -133,17 +133,23 @@ void AssignmentClientMonitor::checkSpares() {
|
|||
}
|
||||
});
|
||||
|
||||
if (spareCount < 1 && totalCount < _maxAssignmentClientForks) {
|
||||
spawnChildClient();
|
||||
// Spawn or kill children, as needed. If --min or --max weren't specified, allow the child count
|
||||
// to drift up or down as far as needed.
|
||||
if (spareCount < 1) {
|
||||
if (!_maxAssignmentClientForks || totalCount < _maxAssignmentClientForks) {
|
||||
spawnChildClient();
|
||||
}
|
||||
}
|
||||
|
||||
if (spareCount > 1 && totalCount > _minAssignmentClientForks) {
|
||||
// kill aSpareId
|
||||
qDebug() << "asking child" << aSpareId << "to exit.";
|
||||
SharedNodePointer childNode = nodeList->nodeWithUUID(aSpareId);
|
||||
childNode->activateLocalSocket();
|
||||
QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode);
|
||||
nodeList->writeUnverifiedDatagram(diePacket, childNode);
|
||||
if (spareCount > 1) {
|
||||
if (!_minAssignmentClientForks || totalCount > _minAssignmentClientForks) {
|
||||
// kill aSpareId
|
||||
qDebug() << "asking child" << aSpareId << "to exit.";
|
||||
SharedNodePointer childNode = nodeList->nodeWithUUID(aSpareId);
|
||||
childNode->activateLocalSocket();
|
||||
QByteArray diePacket = byteArrayWithPopulatedHeader(PacketTypeStopNode);
|
||||
nodeList->writeUnverifiedDatagram(diePacket, childNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue