From e196d2f1f400f5c9634ed42fcbdf5c5fb63a13fb Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Mon, 24 Mar 2014 18:37:31 +0100 Subject: Do not send data if we are connected, send it only once we actually are --- src/xmpp/xmpp_component.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/xmpp') diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp index cd424ed..d30f778 100644 --- a/src/xmpp/xmpp_component.cpp +++ b/src/xmpp/xmpp_component.cpp @@ -82,6 +82,9 @@ void XmppComponent::on_connected() node["to"] = this->served_hostname; this->send_stanza(node); this->doc_open = true; + // We may have some pending data to send: this happens when we try to send + // some data before we are actually connected. We send that data right now, if any + this->send_pending_data(); } void XmppComponent::on_connection_close() @@ -161,6 +164,7 @@ void XmppComponent::on_remote_stream_open(const XmlNode& node) void XmppComponent::on_remote_stream_close(const XmlNode& node) { log_debug("XMPP DOCUMENT CLOSE " << node.to_string()); + this->doc_open = false; } void XmppComponent::on_stanza(const Stanza& stanza) -- cgit v1.2.3