summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-19 11:44:20 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-19 11:59:04 (GMT)
commit1de12ed346fc0018527afe082886129088e27a95 (patch)
tree16013a9294588f505a559a99fe27a603584f2ac2 /Swiften/LinkLocal
parent5d504472c63b7acaa7df99ff1097024cf463f1bd (diff)
downloadswift-1de12ed346fc0018527afe082886129088e27a95.zip
swift-1de12ed346fc0018527afe082886129088e27a95.tar.bz2
(Client)Session & Connection refactoring.
ClientSession no longer sets up a connection. Connection no longer resolves addresses.
Diffstat (limited to 'Swiften/LinkLocal')
-rw-r--r--Swiften/LinkLocal/OutgoingLinkLocalSession.cpp15
-rw-r--r--Swiften/LinkLocal/OutgoingLinkLocalSession.h2
2 files changed, 11 insertions, 6 deletions
diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp
index f32bcdd..f97520a 100644
--- a/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp
+++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.cpp
@@ -55,7 +55,7 @@ void OutgoingLinkLocalSession::handleHostnameResolved(const String& hostname, co
boost::shared_ptr<Connection> connection = connectionFactory_->createConnection();
setConnection(connection);
initializeStreamStack();
- connection->onConnected.connect(boost::bind(&OutgoingLinkLocalSession::handleConnected, boost::dynamic_pointer_cast<OutgoingLinkLocalSession>(shared_from_this())));
+ connection->onConnectFinished.connect(boost::bind(&OutgoingLinkLocalSession::handleConnected, boost::dynamic_pointer_cast<OutgoingLinkLocalSession>(shared_from_this()), _1));
connection->connect(HostAddressPort(*address, port_));
}
else {
@@ -65,10 +65,15 @@ void OutgoingLinkLocalSession::handleHostnameResolved(const String& hostname, co
}
}
-void OutgoingLinkLocalSession::handleConnected() {
- ProtocolHeader header;
- header.setFrom(getLocalJID());
- getXMPPLayer()->writeHeader(header);
+void OutgoingLinkLocalSession::handleConnected(bool error) {
+ if (!error) {
+ ProtocolHeader header;
+ header.setFrom(getLocalJID());
+ getXMPPLayer()->writeHeader(header);
+ }
+ else {
+ // TODO: Error
+ }
}
void OutgoingLinkLocalSession::handleStreamStart(const ProtocolHeader&) {
diff --git a/Swiften/LinkLocal/OutgoingLinkLocalSession.h b/Swiften/LinkLocal/OutgoingLinkLocalSession.h
index abbec80..76ab803 100644
--- a/Swiften/LinkLocal/OutgoingLinkLocalSession.h
+++ b/Swiften/LinkLocal/OutgoingLinkLocalSession.h
@@ -41,7 +41,7 @@ namespace Swift {
void handleElement(boost::shared_ptr<Element>);
void handleStreamStart(const ProtocolHeader&);
void handleHostnameResolved(const String& hostname, const boost::optional<HostAddress>& address);
- void handleConnected();
+ void handleConnected(bool error);
private:
bool resolving_;