From 5507adbe9473f4b41e52d16498f14850773e5e45 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 27 May 2014 01:01:44 +0200 Subject: SocketHandlers own the poller and add themself into it only when the socket is created MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We want to call socket() with the parameters provided by getaddrinfo, so we can’t addd the fd into the poller immediately. We need to wait the connection attempt, and then the SocketHandler can call add_socket_handler itself, if the connection succeeds, or is in progress. --- src/bridge/bridge.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/bridge/bridge.hpp') diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp index f78bade..37f5b05 100644 --- a/src/bridge/bridge.hpp +++ b/src/bridge/bridge.hpp @@ -22,7 +22,7 @@ class Poller; class Bridge { public: - explicit Bridge(const std::string& user_jid, XmppComponent* xmpp, Poller* poller); + explicit Bridge(const std::string& user_jid, XmppComponent* xmpp, std::shared_ptr poller); ~Bridge(); /** * QUIT all connected IRC servers. @@ -146,9 +146,8 @@ private: /** * Poller, to give it the IrcClients that we spawn, to make it manage * their sockets. - * We don't own it. */ - Poller* poller; + std::shared_ptr poller; Bridge(const Bridge&) = delete; Bridge(Bridge&& other) = delete; -- cgit v1.2.3