diff options
author | louiz’ <louiz@louiz.org> | 2017-03-14 21:45:23 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-03-14 21:45:23 +0100 |
commit | 0ab40dc1ab4e689921da54080b135e1d22b1c586 (patch) | |
tree | 238ac477aa6b29a8d1e187a8d97ecbcbbbc663ef /louloulibs/network/dns_handler.cpp | |
parent | 2d3806152e854ace7533fc3ad34d4ac1c44e9687 (diff) | |
download | biboumi-0ab40dc1ab4e689921da54080b135e1d22b1c586.tar.gz biboumi-0ab40dc1ab4e689921da54080b135e1d22b1c586.tar.bz2 biboumi-0ab40dc1ab4e689921da54080b135e1d22b1c586.tar.xz biboumi-0ab40dc1ab4e689921da54080b135e1d22b1c586.zip |
Refactoring louloulibs and cmake
Use OBJECT libraries
Remove the louloulibs directory
Write FOUND variables in the cache
Diffstat (limited to 'louloulibs/network/dns_handler.cpp')
-rw-r--r-- | louloulibs/network/dns_handler.cpp | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/louloulibs/network/dns_handler.cpp b/louloulibs/network/dns_handler.cpp deleted file mode 100644 index 641c087..0000000 --- a/louloulibs/network/dns_handler.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include <louloulibs.h> -#ifdef UDNS_FOUND - -#include <network/dns_socket_handler.hpp> -#include <network/dns_handler.hpp> -#include <network/poller.hpp> - -#include <utils/timed_events.hpp> - -#include <udns.h> -#include <cerrno> -#include <cstring> - -class Resolver; - -using namespace std::string_literals; - -std::unique_ptr<DNSSocketHandler> DNSHandler::socket_handler{}; - -DNSHandler::DNSHandler(std::shared_ptr<Poller>& poller) -{ - dns_init(nullptr, 0); - const auto socket = dns_open(nullptr); - if (socket == -1) - throw std::runtime_error("Failed to initialize udns socket: "s + strerror(errno)); - - DNSHandler::socket_handler = std::make_unique<DNSSocketHandler>(poller, socket); -} - -void DNSHandler::destroy() -{ - DNSHandler::socket_handler.reset(nullptr); - dns_close(nullptr); -} - -void DNSHandler::watch() -{ - DNSHandler::socket_handler->watch(); -} - -void DNSHandler::unwatch() -{ - DNSHandler::socket_handler->unwatch(); -} - -#endif /* UDNS_FOUND */ |