Merge pull request #7980 from zzmp/fix/max-capacity

fix domain max capacity to only count users (not scripted agents)
This commit is contained in:
Brad Hefta-Gaub 2016-06-02 14:54:16 -07:00
commit 281c257d25
2 changed files with 8 additions and 4 deletions

View file

@ -111,7 +111,7 @@
{
"name": "maximum_user_capacity",
"label": "Maximum User Capacity",
"help": "The limit on how many avatars can be connected at once. 0 means no limit.",
"help": "The limit on how many users can be connected at once (0 means no limit). Avatars connected from the same machine will not count towards this limit.",
"placeholder": "0",
"default": "0",
"advanced": false

View file

@ -715,9 +715,13 @@ void DomainServer::processListRequestPacket(QSharedPointer<ReceivedMessage> mess
unsigned int DomainServer::countConnectedUsers() {
unsigned int result = 0;
auto nodeList = DependencyManager::get<LimitedNodeList>();
nodeList->eachNode([&](const SharedNodePointer& otherNode){
if (otherNode->getType() == NodeType::Agent) {
result++;
nodeList->eachNode([&](const SharedNodePointer& node){
// only count unassigned agents (i.e., users)
if (node->getType() == NodeType::Agent) {
auto nodeData = static_cast<DomainServerNodeData*>(node->getLinkedData());
if (nodeData && !nodeData->wasAssigned()) {
result++;
}
}
});
return result;