Always remove all the DNS sockets on an c-ares event

Because c-ares may close one of its socket, even if it’s not the one that
has the event. Otherwise we may not know when a socket has been removed from
our poller (automatically, when close()ed) and this leads to bugs.
This commit is contained in:
louiz’
2016-07-28 10:34:01 +02:00
parent de0eff6e94
commit 11a1c0cc99
4 changed files with 26 additions and 5 deletions
+5 -1
View File
@@ -13,10 +13,12 @@
* (Poller reported it to be writable or readeable)
*/
class DNSHandler;
class DNSSocketHandler: public SocketHandler
{
public:
explicit DNSSocketHandler(std::shared_ptr<Poller> poller, const socket_t socket);
explicit DNSSocketHandler(std::shared_ptr<Poller> poller, DNSHandler& handler, const socket_t socket);
~DNSSocketHandler() = default;
DNSSocketHandler(const DNSSocketHandler&) = delete;
DNSSocketHandler(DNSSocketHandler&&) = delete;
@@ -38,8 +40,10 @@ public:
* Always true, see the comment for connect()
*/
bool is_connected() const override final;
void remove_from_poller();
private:
DNSHandler& handler;
};
#endif // CARES_FOUND