fetchurl: add 'ignore_failures' option

This option is useful in cases where batching is configured and
failing to fetch a resource should not influence the over-all
result.

Issue genodelabs/genodians.org#32.
This commit is contained in:
Josef Söntgen 2023-11-28 16:12:55 +01:00 committed by Norman Feske
parent 4685ba394e
commit 9d989b1557
2 changed files with 13 additions and 1 deletions

View File

@ -8,6 +8,12 @@ for a given amount of time, the transfer will be aborted. The duration can be
set by setting the 'progress_timeout' attribute in the '<config>' node. It is
specified in milliseconds and the default value is 10 seconds.
The 'ignore_failures' attribute instructs the component to always report
success (via exit-code 0). It is useful when batching is used where a
failed fetch operation should not influence the over-all result. The default
value is 'false'.
The following config snippets illustrate its usage.
Load the socket plugin in to the fetchurl binary (print output to log):

View File

@ -115,6 +115,8 @@ struct Fetchurl::Main
Genode::Milliseconds _progress_timeout { 10u * 1000 };
bool _ignore_result { false };
void _schedule_report()
{
using namespace Genode;
@ -189,6 +191,9 @@ struct Fetchurl::Main
};
config_node.for_each_sub_node("fetch", parse_fn);
_ignore_result = config_node.attribute_value("ignore_failures",
_ignore_result);
}
Main(Libc::Env &e) : _env(e)
@ -332,7 +337,8 @@ struct Fetchurl::Main
curl_easy_cleanup(curl);
return exit_res ^ CURLE_OK;
int const result = exit_res ^ CURLE_OK;
return _ignore_result ? 0 : result;
}
};