From 2fe12d374a18bf4c96f98d3e02c484e8307c1fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sun, 19 Jul 2009 18:12:36 +0200 Subject: Fix bug with outgoing link-local connections. diff --git a/Nim/main.cpp b/Nim/main.cpp index 2522a13..a9e9934 100644 --- a/Nim/main.cpp +++ b/Nim/main.cpp @@ -200,7 +200,7 @@ class Server { boost::shared_ptr connector = getLinkLocalConnectorForJID(toJID); if (!connector) { - boost::shared_ptr connector( + connector = boost::shared_ptr( new LinkLocalConnector( toJID, linkLocalRoster_->getHostname(toJID), @@ -210,6 +210,7 @@ class Server { connector->onConnectFinished.connect( boost::bind(&Server::handleConnectFinished, this, connector, _1)); connectors_.push_back(connector); + connector->connect(); } connector->queueElement(element); } @@ -232,10 +233,10 @@ class Server { new OutgoingLinkLocalSession( selfJID_, connector->getRemoteJID(), connector->getConnection(), &payloadParserFactories_, &payloadSerializers_)); - registerLinkLocalSession(outgoingSession); foreach(const boost::shared_ptr element, connector->getQueuedElements()) { outgoingSession->queueElement(element); } + registerLinkLocalSession(outgoingSession); } connectors_.erase(std::remove(connectors_.begin(), connectors_.end(), connector), connectors_.end()); } diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp index 4118e34..1c2fefb 100644 --- a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp +++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp @@ -2,6 +2,7 @@ #include +#include "Swiften/StreamStack/XMPPLayer.h" #include "Swiften/Elements/ProtocolHeader.h" #include "Swiften/Elements/StreamFeatures.h" #include "Swiften/Elements/IQ.h" @@ -19,6 +20,12 @@ OutgoingLinkLocalSession::OutgoingLinkLocalSession( setRemoteJID(remoteJID); } +void OutgoingLinkLocalSession::handleSessionStarted() { + ProtocolHeader header; + header.setFrom(getLocalJID()); + getXMPPLayer()->writeHeader(header); +} + void OutgoingLinkLocalSession::handleStreamStart(const ProtocolHeader&) { foreach(const boost::shared_ptr& stanza, queuedElements_) { sendElement(stanza); diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.h b/Swiften/LinkLocal/OutgoingLinkLocalSession.h index 904a9d3..32f78e4 100644 --- a/Swiften/LinkLocal/OutgoingLinkLocalSession.h +++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.h @@ -27,6 +27,7 @@ namespace Swift { void queueElement(boost::shared_ptr element); private: + void handleSessionStarted(); void handleElement(boost::shared_ptr); void handleStreamStart(const ProtocolHeader&); -- cgit v0.10.2-6-g49f6