| 674 | } |
| 675 | |
| 676 | void CelestialSlaveDatabase::pushResponses(List<CelestialResponse> responses) { |
| 677 | RecursiveMutexLocker locker(m_mutex); |
| 678 | |
| 679 | for (auto& response : responses) { |
| 680 | if (auto celestialChunk = response.leftPtr()) { |
| 681 | m_pendingChunkRequests.remove(celestialChunk->chunkIndex); |
| 682 | m_chunkCache.set(celestialChunk->chunkIndex, std::move(*celestialChunk)); |
| 683 | } else if (auto celestialSystemObjects = response.rightPtr()) { |
| 684 | m_pendingSystemRequests.remove(celestialSystemObjects->systemLocation); |
| 685 | auto chunkLocation = chunkIndexFor(celestialSystemObjects->systemLocation); |
| 686 | if (auto chunk = m_chunkCache.ptr(chunkLocation)) |
| 687 | chunk->systemObjects[celestialSystemObjects->systemLocation] = std::move(celestialSystemObjects->planets); |
| 688 | } |
| 689 | } |
| 690 | } |
| 691 | |
| 692 | void CelestialSlaveDatabase::cleanup() { |
| 693 | RecursiveMutexLocker locker(m_mutex); |