mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-25 03:34:25 +00:00
parent
53c87d18ed
commit
564e6a6885
@ -23,23 +23,34 @@ using namespace Net;
|
|||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
Microseconds Configuration::_init_rtt(Xml_node const node)
|
/***************
|
||||||
|
** Utilities **
|
||||||
|
***************/
|
||||||
|
|
||||||
|
Microseconds read_sec_attr(Xml_node const node,
|
||||||
|
char const *name,
|
||||||
|
unsigned long const default_sec)
|
||||||
{
|
{
|
||||||
unsigned rtt_sec = node.attribute_value("rtt_sec", 0UL);
|
unsigned long sec = node.attribute_value(name, 0UL);
|
||||||
if (!rtt_sec) {
|
if (!sec) {
|
||||||
warning("fall back to default rtt_sec=\"",
|
warning("fall back to default value \"", default_sec,
|
||||||
(unsigned)DEFAULT_RTT_SEC, "\"");
|
"\" for attribute \"", name, "\"");
|
||||||
rtt_sec = DEFAULT_RTT_SEC;
|
sec = default_sec;
|
||||||
}
|
}
|
||||||
return Microseconds(rtt_sec * 1000 * 1000);
|
return Microseconds(sec * 1000 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*******************
|
||||||
|
** Configuration **
|
||||||
|
*******************/
|
||||||
|
|
||||||
Configuration::Configuration(Xml_node const node,
|
Configuration::Configuration(Xml_node const node,
|
||||||
Allocator &alloc)
|
Allocator &alloc)
|
||||||
:
|
:
|
||||||
_alloc(alloc), _verbose(node.attribute_value("verbose", false)),
|
_alloc(alloc), _verbose(node.attribute_value("verbose", false)),
|
||||||
_rtt(_init_rtt(node)), _node(node)
|
_rtt(read_sec_attr(node, "rtt_sec", DEFAULT_RTT_SEC)),
|
||||||
|
_node(node)
|
||||||
{
|
{
|
||||||
/* read domains */
|
/* read domains */
|
||||||
node.for_each_sub_node("domain", [&] (Xml_node const node) {
|
node.for_each_sub_node("domain", [&] (Xml_node const node) {
|
||||||
|
@ -35,8 +35,6 @@ class Net::Configuration
|
|||||||
Domain_tree _domains;
|
Domain_tree _domains;
|
||||||
Genode::Xml_node const _node;
|
Genode::Xml_node const _node;
|
||||||
|
|
||||||
Genode::Microseconds _init_rtt(Genode::Xml_node const node);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum { DEFAULT_RTT_SEC = 6 };
|
enum { DEFAULT_RTT_SEC = 6 };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user