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", "name": "maximum_user_capacity",
"label": "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", "placeholder": "0",
"default": "0", "default": "0",
"advanced": false "advanced": false

View file

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