parent
27c2a66bbd
commit
cd37bff514
|
@ -170,6 +170,24 @@ Configuration::Configuration(Env &env,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Configuration::stop_reporting()
|
||||||
|
{
|
||||||
|
if (!_reporter.valid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_reporter().enabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Configuration::start_reporting()
|
||||||
|
{
|
||||||
|
if (!_reporter.valid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_reporter().enabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Configuration::~Configuration()
|
Configuration::~Configuration()
|
||||||
{
|
{
|
||||||
/* destroy uplinks */
|
/* destroy uplinks */
|
||||||
|
|
|
@ -84,6 +84,10 @@ class Net::Configuration
|
||||||
|
|
||||||
~Configuration();
|
~Configuration();
|
||||||
|
|
||||||
|
void stop_reporting();
|
||||||
|
|
||||||
|
void start_reporting();
|
||||||
|
|
||||||
|
|
||||||
/***************
|
/***************
|
||||||
** Accessors **
|
** Accessors **
|
||||||
|
|
|
@ -74,6 +74,8 @@ Net::Main::Main(Env &env) : _env(env)
|
||||||
|
|
||||||
void Net::Main::_handle_config()
|
void Net::Main::_handle_config()
|
||||||
{
|
{
|
||||||
|
_config().stop_reporting();
|
||||||
|
|
||||||
_config_rom.update();
|
_config_rom.update();
|
||||||
Configuration &old_config = _config();
|
Configuration &old_config = _config();
|
||||||
Configuration &new_config = *new (_heap)
|
Configuration &new_config = *new (_heap)
|
||||||
|
@ -87,6 +89,8 @@ void Net::Main::_handle_config()
|
||||||
_for_each_interface([&] (Interface &intf) { intf.handle_config_3(); });
|
_for_each_interface([&] (Interface &intf) { intf.handle_config_3(); });
|
||||||
|
|
||||||
destroy(_heap, &old_config);
|
destroy(_heap, &old_config);
|
||||||
|
|
||||||
|
_config().start_reporting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,13 +42,14 @@ Net::Report::Report(bool const &verbose,
|
||||||
_domains { domains },
|
_domains { domains },
|
||||||
_timeout { timer, *this, &Report::_handle_report_timeout,
|
_timeout { timer, *this, &Report::_handle_report_timeout,
|
||||||
read_sec_attr(node, "interval_sec", 5) }
|
read_sec_attr(node, "interval_sec", 5) }
|
||||||
{
|
{ }
|
||||||
_reporter.enabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Net::Report::_report()
|
void Net::Report::_report()
|
||||||
{
|
{
|
||||||
|
if (!_reporter.enabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Reporter::Xml_generator xml(_reporter, [&] () {
|
Reporter::Xml_generator xml(_reporter, [&] () {
|
||||||
if (_quota) {
|
if (_quota) {
|
||||||
|
|
Loading…
Reference in New Issue