Showing the changes to interface/src/Application.cpp (1 of 10 files). Show all
Unified · Split
| @@ -4199,9 +4199,11 @@ void Application::nodeKilled(Node* node) { · 4198 unmodified lines | ||
| 4199 | 4199 | } |
| 4200 | 4200 | |
| 4201 | 4201 | // also clean up scene stats for that server |
| 4202 | + _voxelSceneStatsLock.lockForWrite(); | |
| 4202 | 4203 | if (_voxelServerSceneStats.find(nodeUUID) != _voxelServerSceneStats.end()) { |
| 4203 | 4204 | _voxelServerSceneStats.erase(nodeUUID); |
| 4204 | 4205 | } |
| 4206 | + _voxelSceneStatsLock.unlock(); | |
| 4205 | 4207 | } else if (node->getLinkedData() == _lookatTargetAvatar) { |
| 4206 | 4208 | _lookatTargetAvatar = NULL; |
| 4207 | 4209 | } |
| @@ -4222,27 +4224,13 @@ int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLeng · 14 unmodified lines | ||
| 4222 | 4224 | QUuid nodeUUID = voxelServer->getUUID(); |
| 4223 | 4225 | |
| 4224 | 4226 | // now that we know the node ID, let's add these stats to the stats for that node... |
| 4227 | + _voxelSceneStatsLock.lockForWrite(); | |
| 4225 | 4228 | if (_voxelServerSceneStats.find(nodeUUID) != _voxelServerSceneStats.end()) { |
| 4226 | − VoxelSceneStats& oldStats = _voxelServerSceneStats[nodeUUID]; | |
| 4227 | − | |
| 4228 | − // this if construct is a little strange because we aren't quite using it yet. But | |
| 4229 | − // we want to keep this logic in here for now because we plan to use it soon to determine | |
| 4230 | − // additional network optimization states and better rate control | |
| 4231 | − if (!oldStats.isMoving() && temp.isMoving()) { | |
| 4232 | − // we think we are starting to move | |
| 4233 | − _voxelServerSceneStats[nodeUUID].unpackFromMessage(messageData, messageLength); | |
| 4234 | − } else if (oldStats.isMoving() && !temp.isMoving()) { | |
| 4235 | − // we think we are done moving | |
| 4236 | − _voxelServerSceneStats[nodeUUID].unpackFromMessage(messageData, messageLength); | |
| 4237 | − } else if (!oldStats.isMoving() && !temp.isMoving()) { | |
| 4238 | − // we think we are still not moving | |
| 4239 | − } else { | |
| 4240 | − // we think we are still moving | |
| 4241 | − } | |
| 4242 | − | |
| 4229 | + _voxelServerSceneStats[nodeUUID].unpackFromMessage(messageData, messageLength); | |
| 4243 | 4230 | } else { |
| 4244 | 4231 | _voxelServerSceneStats[nodeUUID] = temp; |
| 4245 | 4232 | } |
| 4233 | + _voxelSceneStatsLock.unlock(); | |
| 4246 | 4234 | |
| 4247 | 4235 | VoxelPositionSize rootDetails; |
| 4248 | 4236 | voxelDetailsForCode(temp.getJurisdictionRoot(), rootDetails); |