CLOUD: Notify the backend starting or finishing a download from the cloud

This commit is contained in:
Thierry Crozat 2023-08-04 11:40:47 +02:00 committed by Eugene Sandulenko
parent b0ae8424c9
commit e0c67c3949

View File

@ -57,8 +57,10 @@ void Storage::printErrorResponse(Networking::ErrorResponse error) {
Networking::Request *Storage::addRequest(Networking::Request *request) { Networking::Request *Storage::addRequest(Networking::Request *request) {
_runningRequestsMutex.lock(); _runningRequestsMutex.lock();
++_runningRequestsCount; ++_runningRequestsCount;
if (_runningRequestsCount == 1) if (_runningRequestsCount == 1) {
g_system->taskStarted(OSystem::kCloudDownload);
debug(9, "Storage is working now"); debug(9, "Storage is working now");
}
_runningRequestsMutex.unlock(); _runningRequestsMutex.unlock();
return ConnMan.addRequest(request, new Common::Callback<Storage, Networking::Request *>(this, &Storage::requestFinishedCallback)); return ConnMan.addRequest(request, new Common::Callback<Storage, Networking::Request *>(this, &Storage::requestFinishedCallback));
} }
@ -72,8 +74,10 @@ void Storage::requestFinishedCallback(Networking::Request *invalidRequestPointer
--_runningRequestsCount; --_runningRequestsCount;
if (_syncRestartRequestsed) if (_syncRestartRequestsed)
restartSync = true; restartSync = true;
if (_runningRequestsCount == 0 && !restartSync) if (_runningRequestsCount == 0) {
g_system->taskFinished(OSystem::kCloudDownload);
debug(9, "Storage is not working now"); debug(9, "Storage is not working now");
}
_runningRequestsMutex.unlock(); _runningRequestsMutex.unlock();
if (restartSync) if (restartSync)