diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-18 19:04:32 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-18 20:40:56 (GMT) |
commit | 4457bc810a326de8d7895b3f2ff36ade5f1ae1a0 (patch) | |
tree | 1556c4b0190453897d4799d23b05e651b0bb8a32 /Swiften/Network/BoostConnection.cpp | |
parent | 4052a822acd9da9dab6a8e2343c6170fb08dd8d6 (diff) | |
download | swift-contrib-4457bc810a326de8d7895b3f2ff36ade5f1ae1a0.zip swift-contrib-4457bc810a326de8d7895b3f2ff36ade5f1ae1a0.tar.bz2 |
Implement incoming linklocal connections.
Diffstat (limited to 'Swiften/Network/BoostConnection.cpp')
-rw-r--r-- | Swiften/Network/BoostConnection.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Swiften/Network/BoostConnection.cpp b/Swiften/Network/BoostConnection.cpp index d374221..b064c7a 100644 --- a/Swiften/Network/BoostConnection.cpp +++ b/Swiften/Network/BoostConnection.cpp @@ -51,18 +51,21 @@ void BoostConnection::listen() { void BoostConnection::connect(const String& domain) { DomainNameResolver resolver; try { - HostAddressPort addressPort = resolver.resolve(domain.getUTF8String()); - boost::asio::ip::tcp::endpoint endpoint( - boost::asio::ip::address::from_string(addressPort.getAddress().toString()), addressPort.getPort()); - socket_.async_connect( - endpoint, - boost::bind(&BoostConnection::handleConnectFinished, shared_from_this(), boost::asio::placeholders::error)); + connect(resolver.resolve(domain.getUTF8String())); } catch (const DomainNameResolveException& e) { onDisconnected(DomainNameResolveError); } } +void BoostConnection::connect(const HostAddressPort& addressPort) { + boost::asio::ip::tcp::endpoint endpoint( + boost::asio::ip::address::from_string(addressPort.getAddress().toString()), addressPort.getPort()); + socket_.async_connect( + endpoint, + boost::bind(&BoostConnection::handleConnectFinished, shared_from_this(), boost::asio::placeholders::error)); +} + void BoostConnection::disconnect() { //MainEventLoop::removeEventsFromOwner(shared_from_this()); socket_.close(); |