summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-04-13 01:53:53 +0200
committerFlorent Le Coz <louiz@louiz.org>2015-04-13 01:53:53 +0200
commitd5324ac7780e9a6297631a9c3dc83676e0c1d246 (patch)
tree84a9349bd20aafcf6186242f2a41fde92a55d345 /src
parentffcce28c7711ff69e46445c466bd439362e3d0d4 (diff)
downloadbiboumi-d5324ac7780e9a6297631a9c3dc83676e0c1d246.tar.gz
biboumi-d5324ac7780e9a6297631a9c3dc83676e0c1d246.tar.bz2
biboumi-d5324ac7780e9a6297631a9c3dc83676e0c1d246.tar.xz
biboumi-d5324ac7780e9a6297631a9c3dc83676e0c1d246.zip
Re-order a few things in main.cpp
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 98013eb..cc73244 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -74,11 +74,6 @@ int main(int ac, char** av)
if (hostname.empty())
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
// config
sigset_t mask;
@@ -100,9 +95,11 @@ int main(int ac, char** av)
sigaction(SIGUSR1, &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();
-
#ifdef CARES_FOUND
DNSHandler::instance.watch_dns_sockets(p);
#endif
@@ -119,10 +116,7 @@ int main(int ac, char** av)
exiting = true;
stop.store(false);
xmpp_component->shutdown();
-#ifdef CARES_FOUND
- DNSHandler::instance.destroy();
-#endif
- // Cancel the timer for an potential reconnection
+ // Cancel the timer for a potential reconnection
TimedEventsManager::instance().cancel("XMPP reconnection");
}
if (reload)
@@ -171,6 +165,9 @@ int main(int ac, char** av)
else
timeout = TimedEventsManager::instance().get_timeout();
}
+#ifdef CARES_FOUND
+ DNSHandler::instance.destroy();
+#endif
log_info("All connections cleanly closed, have a nice day.");
return 0;
}