Commit 45aebb8d authored by louiz’'s avatar louiz’

Avoid an exception due to some bad logic in the DNS resolution mechanic

fix #3207
parent b2922560
......@@ -42,7 +42,8 @@ bool DNSSocketHandler::is_connected() const
void DNSSocketHandler::remove_from_poller()
{
this->poller->remove_socket_handler(this->socket);
if (this->poller->is_managing_socket(this->socket))
this->poller->remove_socket_handler(this->socket);
}
#endif /* CARES_FOUND */
......@@ -226,3 +226,8 @@ size_t Poller::size() const
{
return this->socket_handlers.size();
}
bool Poller::is_managing_socket(const socket_t socket) const
{
return (this->socket_handlers.find(socket) != this->socket_handlers.end());
}
......@@ -74,6 +74,10 @@ public:
* Returns the number of SocketHandlers managed by the poller.
*/
size_t size() const;
/**
* Whether the given socket is managed by the poller
*/
bool is_managing_socket(const socket_t socket) const;
private:
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment