History

Fix JurisdictionMap multithreading issues

Make octal code pointers use shared_ptr, add locks around access.

Ryan Huffman committed 10 years ago

Commit ef6d7581 parent 34e574c9 files · +136 −214Browse files

Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all

Unified · Split

interface/src/Application.cpp+7−7
@@ -3656,11 +3656,11 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 3655 unmodified lines
3656 } else {3656 } else {
3657 const JurisdictionMap& map = (jurisdictions)[nodeUUID];3657 const JurisdictionMap& map = (jurisdictions)[nodeUUID];
3658 3658
3659 unsigned char* rootCode = map.getRootOctalCode();3659 auto rootCode = map.getRootOctalCode();
3660 3660
3661 if (rootCode) {3661 if (rootCode) {
3662 VoxelPositionSize rootDetails;3662 VoxelPositionSize rootDetails;
3663 voxelDetailsForCode(rootCode, rootDetails);3663 voxelDetailsForCode(rootCode.get(), rootDetails);
3664 AACube serverBounds(glm::vec3(rootDetails.x * TREE_SCALE,3664 AACube serverBounds(glm::vec3(rootDetails.x * TREE_SCALE,
3665 rootDetails.y * TREE_SCALE,3665 rootDetails.y * TREE_SCALE,
3666 rootDetails.z * TREE_SCALE) - glm::vec3(HALF_TREE_SCALE),3666 rootDetails.z * TREE_SCALE) - glm::vec3(HALF_TREE_SCALE),
@@ -3720,11 +3720,11 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 53 unmodified lines
3720 } else {3720 } else {
3721 const JurisdictionMap& map = (jurisdictions)[nodeUUID];3721 const JurisdictionMap& map = (jurisdictions)[nodeUUID];
3722 3722
3723 unsigned char* rootCode = map.getRootOctalCode();3723 auto rootCode = map.getRootOctalCode();
3724 3724
3725 if (rootCode) {3725 if (rootCode) {
3726 VoxelPositionSize rootDetails;3726 VoxelPositionSize rootDetails;
3727 voxelDetailsForCode(rootCode, rootDetails);3727 voxelDetailsForCode(rootCode.get(), rootDetails);
3728 AACube serverBounds(glm::vec3(rootDetails.x * TREE_SCALE,3728 AACube serverBounds(glm::vec3(rootDetails.x * TREE_SCALE,
3729 rootDetails.y * TREE_SCALE,3729 rootDetails.y * TREE_SCALE,
3730 rootDetails.z * TREE_SCALE) - glm::vec3(HALF_TREE_SCALE),3730 rootDetails.z * TREE_SCALE) - glm::vec3(HALF_TREE_SCALE),
@@ -4251,9 +4251,9 @@ void Application::nodeKilled(SharedNodePointer node) { · 520 unmodified lines
4251 return;4251 return;
4252 }4252 }
4253 4253
4254 unsigned char* rootCode = _entityServerJurisdictions[nodeUUID].getRootOctalCode();4254 auto rootCode = _entityServerJurisdictions[nodeUUID].getRootOctalCode();
4255 VoxelPositionSize rootDetails;4255 VoxelPositionSize rootDetails;
4256 voxelDetailsForCode(rootCode, rootDetails);4256 voxelDetailsForCode(rootCode.get(), rootDetails);
4257 4257
4258 qCDebug(interfaceapp, "model server going away...... v[%f, %f, %f, %f]",4258 qCDebug(interfaceapp, "model server going away...... v[%f, %f, %f, %f]",
4259 (double)rootDetails.x, (double)rootDetails.y, (double)rootDetails.z, (double)rootDetails.s);4259 (double)rootDetails.x, (double)rootDetails.y, (double)rootDetails.z, (double)rootDetails.s);
@@ -4378,7 +4378,7 @@ int Application::processOctreeStats(ReceivedMessage& message, SharedNodePointer · 118 unmodified lines
4378 }4378 }
4379 4379
4380 VoxelPositionSize rootDetails;4380 VoxelPositionSize rootDetails;
4381 voxelDetailsForCode(octreeStats.getJurisdictionRoot(), rootDetails);4381 voxelDetailsForCode(octreeStats.getJurisdictionRoot().get(), rootDetails);
4382 4382
4383 qCDebug(interfaceapp, "stats from new %s server... [%f, %f, %f, %f]",4383 qCDebug(interfaceapp, "stats from new %s server... [%f, %f, %f, %f]",
4384 qPrintable(serverType),4384 qPrintable(serverType),