summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-03-03 11:56:45 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-03-04 16:01:01 (GMT)
commit4b6694377e3a0308009bdf90be0a4e0de463b215 (patch)
tree86b860395d040c38774dfa4400979f9687dff8ae /Swiften/Network/ChainedConnector.cpp
parentfde71bd59b1412ae475c06f2d4100ce088e86af6 (diff)
downloadswift-4b6694377e3a0308009bdf90be0a4e0de463b215.zip
swift-4b6694377e3a0308009bdf90be0a4e0de463b215.tar.bz2
Pass along errors about DNS resolution.
Diffstat (limited to 'Swiften/Network/ChainedConnector.cpp')
-rw-r--r--Swiften/Network/ChainedConnector.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/Swiften/Network/ChainedConnector.cpp b/Swiften/Network/ChainedConnector.cpp
index 1a38e53..0a1283f 100644
--- a/Swiften/Network/ChainedConnector.cpp
+++ b/Swiften/Network/ChainedConnector.cpp
@@ -41,18 +41,18 @@ void ChainedConnector::start() {
void ChainedConnector::stop() {
if (currentConnector) {
- currentConnector->onConnectFinished.disconnect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1));
+ currentConnector->onConnectFinished.disconnect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1, _2));
currentConnector->stop();
currentConnector.reset();
}
- finish(boost::shared_ptr<Connection>());
+ finish(boost::shared_ptr<Connection>(), boost::shared_ptr<Error>());
}
void ChainedConnector::tryNextConnectionFactory() {
assert(!currentConnector);
if (connectionFactoryQueue.empty()) {
SWIFT_LOG(debug) << "No more connection factories" << std::endl;
- finish(boost::shared_ptr<Connection>());
+ finish(boost::shared_ptr<Connection>(), lastError);
}
else {
ConnectionFactory* connectionFactory = connectionFactoryQueue.front();
@@ -60,23 +60,24 @@ void ChainedConnector::tryNextConnectionFactory() {
connectionFactoryQueue.pop_front();
currentConnector = Connector::create(hostname, resolver, connectionFactory, timerFactory);
currentConnector->setTimeoutMilliseconds(timeoutMilliseconds);
- currentConnector->onConnectFinished.connect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1));
+ currentConnector->onConnectFinished.connect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1, _2));
currentConnector->start();
}
}
-void ChainedConnector::handleConnectorFinished(boost::shared_ptr<Connection> connection) {
+void ChainedConnector::handleConnectorFinished(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> error) {
SWIFT_LOG(debug) << "Connector finished" << std::endl;
- currentConnector->onConnectFinished.disconnect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1));
+ currentConnector->onConnectFinished.disconnect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1, _2));
+ lastError = error;
currentConnector.reset();
if (connection) {
- finish(connection);
+ finish(connection, error);
}
else {
tryNextConnectionFactory();
}
}
-void ChainedConnector::finish(boost::shared_ptr<Connection> connection) {
- onConnectFinished(connection);
+void ChainedConnector::finish(boost::shared_ptr<Connection> connection, boost::shared_ptr<Error> error) {
+ onConnectFinished(connection, error);
}