diff options
Diffstat (limited to 'Swiften/LinkLocal/LinkLocalConnector.cpp')
-rw-r--r-- | Swiften/LinkLocal/LinkLocalConnector.cpp | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/Swiften/LinkLocal/LinkLocalConnector.cpp b/Swiften/LinkLocal/LinkLocalConnector.cpp index d89523b..d961030 100644 --- a/Swiften/LinkLocal/LinkLocalConnector.cpp +++ b/Swiften/LinkLocal/LinkLocalConnector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -8,71 +8,71 @@ #include <boost/bind.hpp> +#include <Swiften/LinkLocal/DNSSD/DNSSDQuerier.h> +#include <Swiften/LinkLocal/DNSSD/DNSSDResolveHostnameQuery.h> #include <Swiften/Network/Connection.h> #include <Swiften/Network/ConnectionFactory.h> #include <Swiften/Network/HostAddress.h> #include <Swiften/Network/HostAddressPort.h> -#include <Swiften/LinkLocal/DNSSD/DNSSDQuerier.h> -#include <Swiften/LinkLocal/DNSSD/DNSSDResolveHostnameQuery.h> namespace Swift { LinkLocalConnector::LinkLocalConnector( - const LinkLocalService& service, - boost::shared_ptr<DNSSDQuerier> querier, - boost::shared_ptr<Connection> connection) : - service(service), - querier(querier), - connection(connection) { + const LinkLocalService& service, + std::shared_ptr<DNSSDQuerier> querier, + std::shared_ptr<Connection> connection) : + service(service), + querier(querier), + connection(connection) { } LinkLocalConnector::~LinkLocalConnector() { - assert(!resolveQuery); + assert(!resolveQuery); } void LinkLocalConnector::connect() { - resolveQuery = querier->createResolveHostnameQuery( - service.getHostname(), - service.getID().getNetworkInterfaceID()); - resolveQueryHostNameResolvedConnection = resolveQuery->onHostnameResolved.connect(boost::bind( - &LinkLocalConnector::handleHostnameResolved, - boost::dynamic_pointer_cast<LinkLocalConnector>(shared_from_this()), - _1)); - resolveQuery->run(); + resolveQuery = querier->createResolveHostnameQuery( + service.getHostname(), + service.getID().getNetworkInterfaceID()); + resolveQueryHostNameResolvedConnection = resolveQuery->onHostnameResolved.connect(boost::bind( + &LinkLocalConnector::handleHostnameResolved, + std::dynamic_pointer_cast<LinkLocalConnector>(shared_from_this()), + _1)); + resolveQuery->run(); } void LinkLocalConnector::cancel() { - if (resolveQuery) { - resolveQuery->finish(); - resolveQueryHostNameResolvedConnection.disconnect(); - resolveQuery.reset(); - } - connectionConnectFinishedConnection.disconnect(); - connection->disconnect(); + if (resolveQuery) { + resolveQuery->finish(); + resolveQueryHostNameResolvedConnection.disconnect(); + resolveQuery.reset(); + } + connectionConnectFinishedConnection.disconnect(); + connection->disconnect(); } void LinkLocalConnector::handleHostnameResolved(const boost::optional<HostAddress>& address) { - resolveQuery->finish(); - resolveQueryHostNameResolvedConnection.disconnect(); - resolveQuery.reset(); - if (address) { - connectionConnectFinishedConnection = connection->onConnectFinished.connect( - boost::bind(&LinkLocalConnector::handleConnected, shared_from_this(), _1)); - connection->connect(HostAddressPort(*address, service.getPort())); - } - else { - onConnectFinished(true); - } + resolveQuery->finish(); + resolveQueryHostNameResolvedConnection.disconnect(); + resolveQuery.reset(); + if (address) { + connectionConnectFinishedConnection = connection->onConnectFinished.connect( + boost::bind(&LinkLocalConnector::handleConnected, shared_from_this(), _1)); + connection->connect(HostAddressPort(*address, service.getPort())); + } + else { + onConnectFinished(true); + } } void LinkLocalConnector::handleConnected(bool error) { - onConnectFinished(error); - assert(connectionConnectFinishedConnection.connected()); - connectionConnectFinishedConnection.disconnect(); + onConnectFinished(error); + assert(connectionConnectFinishedConnection.connected()); + connectionConnectFinishedConnection.disconnect(); } -void LinkLocalConnector::queueElement(boost::shared_ptr<ToplevelElement> element) { - queuedElements.push_back(element); +void LinkLocalConnector::queueElement(std::shared_ptr<ToplevelElement> element) { + queuedElements.push_back(element); } |