mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 02:40:08 +00:00
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:
parent
4685ba394e
commit
9d989b1557
@ -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):
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user