From 5b56007828f20c763df3f36ceed809188880663e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?louiz=E2=80=99?= Date: Fri, 6 Jan 2017 22:58:18 +0100 Subject: Use udns instead of c-ares fix #3226 --- src/main.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 060372b..bc8e779 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,7 +6,7 @@ #include #include -#ifdef CARES_FOUND +#ifdef UDNS_FOUND # include #endif @@ -129,15 +129,16 @@ int main(int ac, char** av) auto p = std::make_shared(); +#ifdef UDNS_FOUND + DNSHandler dns_handler(p); +#endif + auto xmpp_component = std::make_shared(p, hostname, password); xmpp_component->start(); IdentdServer identd(*xmpp_component, p, static_cast(Config::get_int("identd_port", 113))); -#ifdef CARES_FOUND - DNSHandler::instance.watch_dns_sockets(p); -#endif auto timeout = TimedEventsManager::instance().get_timeout(); while (p->poll(timeout) != -1) { @@ -155,6 +156,9 @@ int main(int ac, char** av) exiting = true; stop.store(false); xmpp_component->shutdown(); +#ifdef UDNS_FOUND + dns_handler.destroy(); +#endif identd.shutdown(); // Cancel the timer for a potential reconnection TimedEventsManager::instance().cancel("XMPP reconnection"); @@ -200,18 +204,11 @@ int main(int ac, char** av) xmpp_component->close(); if (exiting && p->size() == 1 && xmpp_component->is_document_open()) xmpp_component->close_document(); -#ifdef CARES_FOUND - if (!exiting) - DNSHandler::instance.watch_dns_sockets(p); -#endif if (exiting) // If we are exiting, do not wait for any timed event timeout = utils::no_timeout; else timeout = TimedEventsManager::instance().get_timeout(); } -#ifdef CARES_FOUND - DNSHandler::instance.destroy(); -#endif if (!xmpp_component->ever_auth) return 1; // To signal that the process did not properly start log_info("All connections cleanly closed, have a nice day."); -- cgit v1.2.3