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()
{
/* destroy uplinks */

View File

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

View File

@ -74,6 +74,8 @@ Net::Main::Main(Env &env) : _env(env)
void Net::Main::_handle_config()
{
_config().stop_reporting();
_config_rom.update();
Configuration &old_config = _config();
Configuration &new_config = *new (_heap)
@ -87,6 +89,8 @@ void Net::Main::_handle_config()
_for_each_interface([&] (Interface &intf) { intf.handle_config_3(); });
destroy(_heap, &old_config);
_config().start_reporting();
}

View File

@ -42,13 +42,14 @@ Net::Report::Report(bool const &verbose,
_domains { domains },
_timeout { timer, *this, &Report::_handle_report_timeout,
read_sec_attr(node, "interval_sec", 5) }
{
_reporter.enabled(true);
}
{ }
void Net::Report::_report()
{
if (!_reporter.enabled()) {
return;
}
try {
Reporter::Xml_generator xml(_reporter, [&] () {
if (_quota) {