Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2012-06-06 05:09:33 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:39:30 +0300
commit74a22a60ada2362bc76d7053b52a80346b8590e5 (patch)
tree82f4d0664e5f4c13fcf6dcb85d847f9cd15db8fc /storage/storage.cpp
parent98efcc314a8b5f1345a58615843f905c4135a39c (diff)
[downloader] Fix issue when url download failed. Use default server urls.
Diffstat (limited to 'storage/storage.cpp')
-rw-r--r--storage/storage.cpp29
1 files changed, 8 insertions, 21 deletions
diff --git a/storage/storage.cpp b/storage/storage.cpp
index 78564ebc6b..e4de24d0b2 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -2,20 +2,20 @@
#include "../defines.hpp"
-#include "../base/logging.hpp"
-#include "../base/string_utils.hpp"
-
#include "../indexer/data_factory.hpp"
#include "../indexer/search_index_builder.hpp"
#include "../platform/platform.hpp"
-#include "../platform/settings.hpp"
+#include "../platform/servers_list.hpp"
#include "../coding/file_writer.hpp"
#include "../coding/file_reader.hpp"
#include "../coding/file_container.hpp"
#include "../coding/url_encode.hpp"
+#include "../base/logging.hpp"
+#include "../base/string_utils.hpp"
+
#include "../version/version.hpp"
#include "../std/algorithm.hpp"
@@ -23,9 +23,6 @@
#include "../std/bind.hpp"
#include "../std/sstream.hpp"
-#include "../3party/jansson/myjansson.hpp"
-
-#define SETTINGS_SERVERS_KEY "LastBaseUrls"
using namespace downloader;
@@ -468,21 +465,11 @@ namespace storage
CountryFile const & file = CountryByIndex(m_queue.front()).Files().front();
vector<string> urls;
- if (request.Status() == HttpRequest::ECompleted
- && ParseServerList(request.Data(), urls))
- Settings::Set(SETTINGS_SERVERS_KEY, request.Data());
- else
- {
- string serverList;
- if (!Settings::Get(SETTINGS_SERVERS_KEY, serverList))
- serverList = GetPlatform().DefaultUrlsJSON();
- VERIFY(ParseServerList(serverList, urls), ());
- }
+ GetServerListFromRequest(request, urls);
// append actual version and file name
for (size_t i = 0; i < urls.size(); ++i)
- urls[i] = urls[i] + OMIM_OS_NAME "/"
- + strings::to_string(m_currentVersion) + "/" + UrlEncode(file.GetFileWithExt());
+ urls[i] = GetFileDownloadUrl(urls[i], file.GetFileWithExt());
m_request.reset(HttpRequest::GetFile(urls,
GetPlatform().WritablePathForFile(file.GetFileWithExt()),
@@ -491,9 +478,9 @@ namespace storage
bind(&Storage::OnMapDownloadProgress, this, _1)));
}
- int64_t Storage::GetCurrentVersion() const
+ string Storage::GetFileDownloadUrl(string const & baseUrl, string const & fName) const
{
- return m_currentVersion;
+ return baseUrl + OMIM_OS_NAME "/" + strings::to_string(m_currentVersion) + "/" + UrlEncode(fName);
}
TIndex const Storage::FindIndexByName(string const & name) const