Re-order a few things in main.cpp
This commit is contained in:
+7
-10
@@ -74,11 +74,6 @@ int main(int ac, char** av)
|
|||||||
if (hostname.empty())
|
if (hostname.empty())
|
||||||
return config_help("hostname");
|
return config_help("hostname");
|
||||||
|
|
||||||
auto p = std::make_shared<Poller>();
|
|
||||||
auto xmpp_component = std::make_shared<BiboumiComponent>(p,
|
|
||||||
hostname,
|
|
||||||
password);
|
|
||||||
|
|
||||||
// Install the signals used to exit the process cleanly, or reload the
|
// Install the signals used to exit the process cleanly, or reload the
|
||||||
// config
|
// config
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
@@ -100,9 +95,11 @@ int main(int ac, char** av)
|
|||||||
sigaction(SIGUSR1, &on_sigusr, nullptr);
|
sigaction(SIGUSR1, &on_sigusr, nullptr);
|
||||||
sigaction(SIGUSR2, &on_sigusr, nullptr);
|
sigaction(SIGUSR2, &on_sigusr, nullptr);
|
||||||
|
|
||||||
|
auto p = std::make_shared<Poller>();
|
||||||
|
auto xmpp_component =
|
||||||
|
std::make_shared<BiboumiComponent>(p, hostname, password);
|
||||||
xmpp_component->start();
|
xmpp_component->start();
|
||||||
|
|
||||||
|
|
||||||
#ifdef CARES_FOUND
|
#ifdef CARES_FOUND
|
||||||
DNSHandler::instance.watch_dns_sockets(p);
|
DNSHandler::instance.watch_dns_sockets(p);
|
||||||
#endif
|
#endif
|
||||||
@@ -119,10 +116,7 @@ int main(int ac, char** av)
|
|||||||
exiting = true;
|
exiting = true;
|
||||||
stop.store(false);
|
stop.store(false);
|
||||||
xmpp_component->shutdown();
|
xmpp_component->shutdown();
|
||||||
#ifdef CARES_FOUND
|
// Cancel the timer for a potential reconnection
|
||||||
DNSHandler::instance.destroy();
|
|
||||||
#endif
|
|
||||||
// Cancel the timer for an potential reconnection
|
|
||||||
TimedEventsManager::instance().cancel("XMPP reconnection");
|
TimedEventsManager::instance().cancel("XMPP reconnection");
|
||||||
}
|
}
|
||||||
if (reload)
|
if (reload)
|
||||||
@@ -171,6 +165,9 @@ int main(int ac, char** av)
|
|||||||
else
|
else
|
||||||
timeout = TimedEventsManager::instance().get_timeout();
|
timeout = TimedEventsManager::instance().get_timeout();
|
||||||
}
|
}
|
||||||
|
#ifdef CARES_FOUND
|
||||||
|
DNSHandler::instance.destroy();
|
||||||
|
#endif
|
||||||
log_info("All connections cleanly closed, have a nice day.");
|
log_info("All connections cleanly closed, have a nice day.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user