nic_router: optimize handling of invalid domains

Dissolve and destroy the invalid domain first before deinitializing all
domains for the next round. This way, the deinitialization is not done twice
for the invalid domain.

Issue #2840
This commit is contained in:
Martin Stein 2018-06-13 15:36:00 +02:00 committed by Norman Feske
parent 27155a507f
commit ff7bc0ac6c

View File

@ -96,16 +96,16 @@ Configuration::Configuration(Env &env,
}
catch (Retry_without_domain exception) {
/* deinitialize all domains again */
/* destroy domain that became invalid during initialization */
_domains.remove(exception.domain);
destroy(_alloc, &exception.domain);
/* deinitialize the remaining domains again */
_domains.for_each([&] (Domain &domain) {
domain.deinit();
if (_verbose) {
log("[", domain, "] deinitiated domain"); }
});
/* destroy domain that became invalid during initialization */
_domains.remove(exception.domain);
destroy(_alloc, &exception.domain);
/* retry to initialize the remaining domains */
continue;
}