SocketHandlers own the poller and add themself into it only when the socket is created

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.
This commit is contained in:
Florent Le Coz
2014-05-27 01:01:44 +02:00
parent 6b0ffb5fc2
commit 5507adbe94
11 changed files with 29 additions and 39 deletions
+2 -1
View File
@@ -8,6 +8,7 @@
#include <network/socket_handler.hpp>
#include <unordered_map>
#include <memory>
#include <vector>
#include <string>
#include <map>
@@ -23,7 +24,7 @@ class Bridge;
class IrcClient: public SocketHandler
{
public:
explicit IrcClient(const std::string& hostname, const std::string& username, Bridge* bridge);
explicit IrcClient(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& username, Bridge* bridge);
~IrcClient();
/**
* Connect to the IRC server