mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-11 06:54:18 +00:00
depot_download: avoid spurious respawn of fetchurl
Thanks to Timo Nicolai for bringing up this issue along with an initial patch. Fixes #4815
This commit is contained in:
parent
a5eb198549
commit
c705bdd6a9
@ -240,22 +240,28 @@ struct Depot_download_manager::Main : Import::Download_progress
|
|||||||
|
|
||||||
uint64_t _observed_downloaded_bytes = _main._downloaded_bytes;
|
uint64_t _observed_downloaded_bytes = _main._downloaded_bytes;
|
||||||
|
|
||||||
|
uint64_t _started_ms = _timer.elapsed_ms();
|
||||||
|
|
||||||
|
enum { PERIOD_SECONDS = 5UL };
|
||||||
|
|
||||||
void _handle()
|
void _handle()
|
||||||
{
|
{
|
||||||
if (_main._downloaded_bytes != _observed_downloaded_bytes) {
|
uint64_t const now_ms = _timer.elapsed_ms();
|
||||||
_observed_downloaded_bytes = _main._downloaded_bytes;
|
|
||||||
|
bool starting_up = (now_ms - _started_ms < PERIOD_SECONDS*1000);
|
||||||
|
bool made_progress = (_main._downloaded_bytes != _observed_downloaded_bytes);
|
||||||
|
|
||||||
|
if (starting_up || made_progress)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
warning("fetchurl got stuck, respawning");
|
warning("fetchurl got stuck, respawning");
|
||||||
|
|
||||||
/* downloads got stuck, try replacing fetchurl with new instance */
|
/* downloads got stuck, try replacing fetchurl with new instance */
|
||||||
_main._fetchurl_count.value++;
|
_main._fetchurl_count.value++;
|
||||||
_main._generate_init_config();
|
_main._generate_init_config();
|
||||||
|
_started_ms = now_ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum { PERIOD_SECONDS = 5UL };
|
|
||||||
|
|
||||||
Fetchurl_watchdog(Main &main) : _main(main)
|
Fetchurl_watchdog(Main &main) : _main(main)
|
||||||
{
|
{
|
||||||
_timer.sigh(_handler);
|
_timer.sigh(_handler);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user