Refactoring louloulibs and cmake

Use OBJECT libraries
Remove the louloulibs directory
Write FOUND variables in the cache
This commit is contained in:
louiz’
2017-03-14 21:45:23 +01:00
parent 2d3806152e
commit 0ab40dc1ab
77 changed files with 219 additions and 280 deletions
+46
View File
@@ -0,0 +1,46 @@
#include <biboumi.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 */