diff options
Diffstat (limited to 'Swiften/Network/Connector.cpp')
| -rw-r--r-- | Swiften/Network/Connector.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp index 5eddaba..a0e6b23 100644 --- a/Swiften/Network/Connector.cpp +++ b/Swiften/Network/Connector.cpp @@ -15,11 +15,11 @@ #include <Swiften/Network/HostAddress.h> #include <Swiften/Network/TimerFactory.h> namespace Swift { -Connector::Connector(const std::string& hostname, int port, const boost::optional<std::string>& serviceLookupPrefix, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) : hostname(hostname), port(port), serviceLookupPrefix(serviceLookupPrefix), resolver(resolver), connectionFactory(connectionFactory), timerFactory(timerFactory), timeoutMilliseconds(0), queriedAllServices(true), foundSomeDNS(false) { +Connector::Connector(const std::string& hostname, unsigned short port, const boost::optional<std::string>& serviceLookupPrefix, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) : hostname(hostname), port(port), serviceLookupPrefix(serviceLookupPrefix), resolver(resolver), connectionFactory(connectionFactory), timerFactory(timerFactory), timeoutMilliseconds(0), queriedAllServices(true), foundSomeDNS(false) { } void Connector::setTimeoutMilliseconds(int milliseconds) { timeoutMilliseconds = milliseconds; } @@ -27,17 +27,17 @@ void Connector::setTimeoutMilliseconds(int milliseconds) { void Connector::start() { SWIFT_LOG(debug) << "Starting connector for " << hostname << std::endl; assert(!currentConnection); assert(!serviceQuery); assert(!timer); - queriedAllServices = false; auto hostAddress = HostAddress::fromString(hostname); if (timeoutMilliseconds > 0) { timer = timerFactory->createTimer(timeoutMilliseconds); timer->onTick.connect(boost::bind(&Connector::handleTimeout, shared_from_this())); } if (serviceLookupPrefix) { + queriedAllServices = false; serviceQuery = resolver->createServiceQuery(*serviceLookupPrefix, hostname); serviceQuery->onResult.connect(boost::bind(&Connector::handleServiceQueryResult, shared_from_this(), _1)); serviceQuery->run(); } else if (hostAddress) { @@ -120,11 +120,11 @@ void Connector::tryNextAddress() { else { SWIFT_LOG(debug) << "Trying next address" << std::endl; HostAddress address = addressQueryResults.front(); addressQueryResults.pop_front(); - int connectPort = (port == -1 ? 5222 : port); + unsigned short connectPort = (port == 0 ? 5222 : port); if (!serviceQueryResults.empty()) { connectPort = serviceQueryResults.front().port; } tryConnect(HostAddressPort(address, connectPort)); |
Swift