Showing the changes to interface/src/Application.cpp (1 of 10 files). Show all
Unified · Split
| @@ -4291,9 +4291,11 @@ void Application::nodeKilled(Node* node) { · 4290 unmodified lines | ||
| 4291 | 4291 | } |
| 4292 | 4292 | |
| 4293 | 4293 | // also clean up scene stats for that server |
| 4294 | + _voxelSceneStatsLock.lockForWrite(); | |
| 4294 | 4295 | if (_voxelServerSceneStats.find(nodeUUID) != _voxelServerSceneStats.end()) { |
| 4295 | 4296 | _voxelServerSceneStats.erase(nodeUUID); |
| 4296 | 4297 | } |
| 4298 | + _voxelSceneStatsLock.unlock(); | |
| 4297 | 4299 | } else if (node->getLinkedData() == _lookatTargetAvatar) { |
| 4298 | 4300 | _lookatTargetAvatar = NULL; |
| 4299 | 4301 | } |
| @@ -4314,27 +4316,13 @@ int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLeng · 14 unmodified lines | ||
| 4314 | 4316 | QUuid nodeUUID = voxelServer->getUUID(); |
| 4315 | 4317 | |
| 4316 | 4318 | // now that we know the node ID, let's add these stats to the stats for that node... |
| 4319 | + _voxelSceneStatsLock.lockForWrite(); | |
| 4317 | 4320 | if (_voxelServerSceneStats.find(nodeUUID) != _voxelServerSceneStats.end()) { |
| 4318 | − VoxelSceneStats& oldStats = _voxelServerSceneStats[nodeUUID]; | |
| 4319 | − | |
| 4320 | − // this if construct is a little strange because we aren't quite using it yet. But | |
| 4321 | − // we want to keep this logic in here for now because we plan to use it soon to determine | |
| 4322 | − // additional network optimization states and better rate control | |
| 4323 | − if (!oldStats.isMoving() && temp.isMoving()) { | |
| 4324 | − // we think we are starting to move | |
| 4325 | − _voxelServerSceneStats[nodeUUID].unpackFromMessage(messageData, messageLength); | |
| 4326 | − } else if (oldStats.isMoving() && !temp.isMoving()) { | |
| 4327 | − // we think we are done moving | |
| 4328 | − _voxelServerSceneStats[nodeUUID].unpackFromMessage(messageData, messageLength); | |
| 4329 | − } else if (!oldStats.isMoving() && !temp.isMoving()) { | |
| 4330 | − // we think we are still not moving | |
| 4331 | − } else { | |
| 4332 | − // we think we are still moving | |
| 4333 | − } | |
| 4334 | − | |
| 4321 | + _voxelServerSceneStats[nodeUUID].unpackFromMessage(messageData, messageLength); | |
| 4335 | 4322 | } else { |
| 4336 | 4323 | _voxelServerSceneStats[nodeUUID] = temp; |
| 4337 | 4324 | } |
| 4325 | + _voxelSceneStatsLock.unlock(); | |
| 4338 | 4326 | |
| 4339 | 4327 | VoxelPositionSize rootDetails; |
| 4340 | 4328 | voxelDetailsForCode(temp.getJurisdictionRoot(), rootDetails); |