forked from organicmaps/organicmaps
Fixed download failure notification
This commit is contained in:
parent
b36f653eaf
commit
9cc1fb3862
3 changed files with 22 additions and 6 deletions
|
@ -218,6 +218,9 @@ class FileHttpRequest : public HttpRequest, public IHttpThreadCallback
|
|||
|
||||
void SaveResumeChunks()
|
||||
{
|
||||
if (m_writer == nullptr)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
// Flush writer before saving downloaded chunks.
|
||||
|
@ -275,6 +278,11 @@ class FileHttpRequest : public HttpRequest, public IHttpThreadCallback
|
|||
if (m_status != ECompleted && m_goodChunksCount % 10 == 0)
|
||||
SaveResumeChunks();
|
||||
}
|
||||
else if (result == ChunksDownloadStrategy::ENoFreeServers)
|
||||
{
|
||||
// There is no any server which is able to re-download chunk.
|
||||
m_status = EFailed;
|
||||
}
|
||||
|
||||
if (m_status != EInProgress)
|
||||
{
|
||||
|
|
|
@ -825,8 +825,7 @@ void Storage::RegisterDownloadedFiles(TCountryId const & countryId, MapOptions o
|
|||
ASSERT_THREAD_CHECKER(m_threadChecker, ());
|
||||
if (!isSuccess)
|
||||
{
|
||||
m_failedCountries.insert(countryId);
|
||||
NotifyStatusChangedForHierarchy(countryId);
|
||||
OnDownloadFailed(countryId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -907,8 +906,7 @@ void Storage::OnMapDownloadFinished(TCountryId const & countryId, bool success,
|
|||
|
||||
if (!success)
|
||||
{
|
||||
m_failedCountries.insert(countryId);
|
||||
NotifyStatusChangedForHierarchy(countryId);
|
||||
OnDownloadFailed(countryId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1452,8 +1450,7 @@ void Storage::OnDiffStatusReceived(diffs::Status const status)
|
|||
ASSERT_THREAD_CHECKER(m_threadChecker, ());
|
||||
if (!isSuccess)
|
||||
{
|
||||
m_failedCountries.insert(countryId);
|
||||
NotifyStatusChangedForHierarchy(countryId);
|
||||
OnDownloadFailed(countryId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1884,4 +1881,13 @@ TMwmSize Storage::GetRemoteSize(CountryFile const & file, MapOptions opt, int64_
|
|||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
void Storage::OnDownloadFailed(TCountryId const & countryId)
|
||||
{
|
||||
m_failedCountries.insert(countryId);
|
||||
auto it = find(m_queue.cbegin(), m_queue.cend(), countryId);
|
||||
if (it != m_queue.cend())
|
||||
m_queue.erase(it);
|
||||
NotifyStatusChangedForHierarchy(countryId);
|
||||
}
|
||||
} // namespace storage
|
||||
|
|
|
@ -656,6 +656,8 @@ private:
|
|||
bool IsDisputed(TCountryTreeNode const & node) const;
|
||||
|
||||
void CalMaxMwmSizeBytes();
|
||||
|
||||
void OnDownloadFailed(TCountryId const & countryId);
|
||||
|
||||
void LoadDiffScheme();
|
||||
void ApplyDiff(TCountryId const & countryId, function<void(bool isSuccess)> const & fn);
|
||||
|
|
Loading…
Add table
Reference in a new issue