nic_router: do not report while re-configuring

Fixes #3528
This commit is contained in:
Martin Stein 2019-10-15 19:43:41 +02:00 committed by Christian Helmuth
parent 27c2a66bbd
commit cd37bff514
4 changed files with 30 additions and 3 deletions

View File

@ -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 */

View File

@ -84,6 +84,10 @@ class Net::Configuration
~Configuration(); ~Configuration();
void stop_reporting();
void start_reporting();
/*************** /***************
** Accessors ** ** Accessors **

View File

@ -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();
} }

View File

@ -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) {