summaryrefslogtreecommitdiff
path: root/louloulibs/network/dns_handler.cpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-07-07 09:27:22 +0200
committerlouiz’ <louiz@louiz.org>2016-07-12 11:15:42 +0200
commit5328d0806fdc5becb9344b4d4320787a2b7c0712 (patch)
tree5d3547e1c84f7ef6b86e10842ed0bb87bf6b5588 /louloulibs/network/dns_handler.cpp
parent9fb2e116c47a9d4e2866d34450d12dcb90d4a26c (diff)
downloadbiboumi-5328d0806fdc5becb9344b4d4320787a2b7c0712.tar.gz
biboumi-5328d0806fdc5becb9344b4d4320787a2b7c0712.tar.bz2
biboumi-5328d0806fdc5becb9344b4d4320787a2b7c0712.tar.xz
biboumi-5328d0806fdc5becb9344b4d4320787a2b7c0712.zip
Don’t use unique_ptr to store dns socket handlers
Diffstat (limited to 'louloulibs/network/dns_handler.cpp')
-rw-r--r--louloulibs/network/dns_handler.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/louloulibs/network/dns_handler.cpp b/louloulibs/network/dns_handler.cpp
index 5e19f8c..24c4bcf 100644
--- a/louloulibs/network/dns_handler.cpp
+++ b/louloulibs/network/dns_handler.cpp
@@ -68,7 +68,7 @@ void DNSHandler::watch_dns_sockets(std::shared_ptr<Poller>& poller)
std::remove_if(this->socket_handlers.begin(), this->socket_handlers.end(),
[&readers](const auto& dns_socket)
{
- return !FD_ISSET(dns_socket->get_socket(), &readers);
+ return !FD_ISSET(dns_socket.get_socket(), &readers);
}),
this->socket_handlers.end());
@@ -81,8 +81,8 @@ void DNSHandler::watch_dns_sockets(std::shared_ptr<Poller>& poller)
this->socket_handlers.end(),
[i](const auto& socket_handler)
{
- return i == socket_handler->get_socket();
- });
+ return i == socket_handler.get_socket();
+ });
if (!read && !write) // No need to read or write to it
{ // If found, erase it and stop watching it because it is not
// needed anymore
@@ -95,12 +95,12 @@ void DNSHandler::watch_dns_sockets(std::shared_ptr<Poller>& poller)
if (it == this->socket_handlers.end())
{
this->socket_handlers.emplace(this->socket_handlers.begin(),
- std::make_unique<DNSSocketHandler>(poller, i));
+ poller, i);
it = this->socket_handlers.begin();
}
- poller->add_socket_handler(it->get());
+ poller->add_socket_handler(&*it);
if (write)
- poller->watch_send_events(it->get());
+ poller->watch_send_events(&*it);
}
}
// Cancel previous timer, if any.
@@ -116,7 +116,7 @@ void DNSHandler::watch_dns_sockets(std::shared_ptr<Poller>& poller)
[this]()
{
for (auto& dns_socket_handler: this->socket_handlers)
- dns_socket_handler->on_recv();
+ dns_socket_handler.on_recv();
},
"DNS timeout"));
}