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:
@@ -13,7 +13,8 @@
|
||||
#include <string>
|
||||
using namespace std::string_literals;
|
||||
|
||||
IrcClient::IrcClient(const std::string& hostname, const std::string& username, Bridge* bridge):
|
||||
IrcClient::IrcClient(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& username, Bridge* bridge):
|
||||
SocketHandler(poller),
|
||||
hostname(hostname),
|
||||
username(username),
|
||||
current_nick(username),
|
||||
|
||||
Reference in New Issue
Block a user