| 215 | } |
| 216 | |
| 217 | void Storage::PersistAndApplyCountries(std::shared_ptr<std::string> buffer, int64_t parsedVersion) |
| 218 | { |
| 219 | ASSERT_GREATER(parsedVersion, m_currentVersion, ()); |
| 220 | |
| 221 | LOG(LDEBUG, ("COUNTRIES: saving downloaded", COUNTRIES_FILE)); |
| 222 | GetPlatform().RunTask(Platform::Thread::File, [buffer]() { (void)SaveCountriesToWritableDirAtomic(*buffer); }); |
| 223 | |
| 224 | LOG(LDEBUG, ("COUNTRIES: applying downloaded", COUNTRIES_FILE)); |
| 225 | GetPlatform().RunTask(Platform::Thread::Gui, [this, buffer, parsedVersion]() |
| 226 | { |
| 227 | if (IsInitialResourcesDownloadRequired()) |
| 228 | { |
| 229 | /// @todo(pastk): actually need to always check for updates and download latest Worlds |
| 230 | // Persist, but do NOT hot-apply during initial Worlds download flow. |
| 231 | if (!m_hasPendingCountries || parsedVersion > m_pendingCountriesVersion) |
| 232 | { |
| 233 | m_pendingCountriesBuffer = *buffer; |
| 234 | m_pendingCountriesVersion = parsedVersion; |
| 235 | m_hasPendingCountries = true; |
| 236 | } |
| 237 | LOG(LINFO, ("COUNTRIES: initial resources download active; deferring apply. version=", parsedVersion)); |
| 238 | return; |
| 239 | } |
| 240 | |
| 241 | if (IsIdleForCountriesApply()) |
| 242 | { |
| 243 | ApplyCountriesInMemory(*buffer); |
| 244 | return; |
| 245 | } |
| 246 | |
| 247 | if (!m_hasPendingCountries || parsedVersion > m_pendingCountriesVersion) |
| 248 | { |
| 249 | m_pendingCountriesBuffer = *buffer; |
| 250 | m_pendingCountriesVersion = parsedVersion; |
| 251 | m_hasPendingCountries = true; |
| 252 | LOG(LDEBUG, ("COUNTRIES: queued apply for later. version=", m_pendingCountriesVersion)); |
| 253 | } |
| 254 | }); |
| 255 | } |
| 256 | |
| 257 | int64_t Storage::ParseServerMapsAndGetLatestVersion(std::string const & buffer, bool & isEOL) const |
| 258 | { |
nothing calls this directly
no test coverage detected