summaryrefslogtreecommitdiff
path: root/src/xmpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-05-27 01:01:44 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-05-27 01:01:44 +0200
commit5507adbe9473f4b41e52d16498f14850773e5e45 (patch)
tree34f2960edf6b73828537460cc50e6cdb9252a5e3 /src/xmpp
parent6b0ffb5fc2eca537e2cfaf24acb8a4d2ca9b99f1 (diff)
downloadbiboumi-5507adbe9473f4b41e52d16498f14850773e5e45.tar.gz
biboumi-5507adbe9473f4b41e52d16498f14850773e5e45.tar.bz2
biboumi-5507adbe9473f4b41e52d16498f14850773e5e45.tar.xz
biboumi-5507adbe9473f4b41e52d16498f14850773e5e45.zip
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.
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/xmpp_component.cpp3
-rw-r--r--src/xmpp/xmpp_component.hpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp
index 32f5d96..55f0ca4 100644
--- a/src/xmpp/xmpp_component.cpp
+++ b/src/xmpp/xmpp_component.cpp
@@ -47,7 +47,8 @@ static std::set<std::string> kickable_errors{
"malformed-error"
};
-XmppComponent::XmppComponent(const std::string& hostname, const std::string& secret):
+XmppComponent::XmppComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret):
+ SocketHandler(poller),
ever_auth(false),
last_auth(false),
served_hostname(hostname),
diff --git a/src/xmpp/xmpp_component.hpp b/src/xmpp/xmpp_component.hpp
index fdf068b..f081420 100644
--- a/src/xmpp/xmpp_component.hpp
+++ b/src/xmpp/xmpp_component.hpp
@@ -18,7 +18,7 @@
class XmppComponent: public SocketHandler
{
public:
- explicit XmppComponent(const std::string& hostname, const std::string& secret);
+ explicit XmppComponent(std::shared_ptr<Poller> poller, const std::string& hostname, const std::string& secret);
~XmppComponent();
void on_connection_failed(const std::string& reason) override final;