diff options
| author | Edwin Mons <edwin.mons@isode.com> | 2019-11-19 13:36:05 (GMT) |
|---|---|---|
| committer | Edwin Mons <edwin.mons@isode.com> | 2019-11-19 13:58:45 (GMT) |
| commit | 261ba8d8595ed8cb90f9c4feb1d6ef642942bcba (patch) | |
| tree | c7e60d473509db8c4dbff5aa83fbde963d8dd75e /Swiften/Network | |
| parent | 697ae6ae84512a744958b24118197ec7bfdbc1f0 (diff) | |
| download | swift-261ba8d8595ed8cb90f9c4feb1d6ef642942bcba.zip swift-261ba8d8595ed8cb90f9c4feb1d6ef642942bcba.tar.bz2 | |
Remove std::endl from SWIFT_LOG calls
The std::endl is now added by ~Log, but only for output to stderr or a
log file. Calls to the Android logging system or manually set callbacks
will not include the newline in the logging output.
JIRA: SWIFT-430
Test-Information:
Unit tests pass on Debian 9
Checked that running Swift with logging to stderr still had a newline.
Change-Id: I096fdba78a3b8f87db2097951c28c528592183e8
Diffstat (limited to 'Swiften/Network')
| -rw-r--r-- | Swiften/Network/BOSHConnection.cpp | 16 | ||||
| -rw-r--r-- | Swiften/Network/BOSHConnectionPool.cpp | 4 | ||||
| -rw-r--r-- | Swiften/Network/BoostConnection.cpp | 8 | ||||
| -rw-r--r-- | Swiften/Network/BoostConnectionServer.cpp | 4 | ||||
| -rw-r--r-- | Swiften/Network/ChainedConnector.cpp | 10 | ||||
| -rw-r--r-- | Swiften/Network/Connector.cpp | 26 | ||||
| -rw-r--r-- | Swiften/Network/EnvironmentProxyProvider.cpp | 4 | ||||
| -rw-r--r-- | Swiften/Network/GConfProxyProvider.cpp | 4 | ||||
| -rw-r--r-- | Swiften/Network/HTTPConnectProxiedConnection.cpp | 12 | ||||
| -rw-r--r-- | Swiften/Network/HostAddress.cpp | 4 | ||||
| -rw-r--r-- | Swiften/Network/NATPMPInterface.cpp | 14 | ||||
| -rw-r--r-- | Swiften/Network/PlatformDomainNameServiceQuery.cpp | 6 | ||||
| -rw-r--r-- | Swiften/Network/PlatformNATTraversalWorker.cpp | 4 | ||||
| -rw-r--r-- | Swiften/Network/ProxiedConnection.cpp | 4 | ||||
| -rw-r--r-- | Swiften/Network/SOCKS5ProxiedConnection.cpp | 14 | ||||
| -rw-r--r-- | Swiften/Network/UnboundDomainNameResolver.cpp | 26 | ||||
| -rw-r--r-- | Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp | 6 | ||||
| -rw-r--r-- | Swiften/Network/WindowsProxyProvider.cpp | 4 |
18 files changed, 85 insertions, 85 deletions
diff --git a/Swiften/Network/BOSHConnection.cpp b/Swiften/Network/BOSHConnection.cpp index aaec9f2..1312a3e 100644 --- a/Swiften/Network/BOSHConnection.cpp +++ b/Swiften/Network/BOSHConnection.cpp | |||
| @@ -74,27 +74,27 @@ void BOSHConnection::cancelConnector() { | |||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | void BOSHConnection::handleTLSConnected() { | 76 | void BOSHConnection::handleTLSConnected() { |
| 77 | SWIFT_LOG(debug) << std::endl; | 77 | SWIFT_LOG(debug); |
| 78 | onConnectFinished(false); | 78 | onConnectFinished(false); |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | void BOSHConnection::handleTLSApplicationDataRead(const SafeByteArray& data) { | 81 | void BOSHConnection::handleTLSApplicationDataRead(const SafeByteArray& data) { |
| 82 | SWIFT_LOG(debug) << std::endl; | 82 | SWIFT_LOG(debug); |
| 83 | handleDataRead(std::make_shared<SafeByteArray>(data)); | 83 | handleDataRead(std::make_shared<SafeByteArray>(data)); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | void BOSHConnection::handleTLSNetowrkDataWriteRequest(const SafeByteArray& data) { | 86 | void BOSHConnection::handleTLSNetowrkDataWriteRequest(const SafeByteArray& data) { |
| 87 | SWIFT_LOG(debug) << std::endl; | 87 | SWIFT_LOG(debug); |
| 88 | connection_->write(data); | 88 | connection_->write(data); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | void BOSHConnection::handleRawDataRead(std::shared_ptr<SafeByteArray> data) { | 91 | void BOSHConnection::handleRawDataRead(std::shared_ptr<SafeByteArray> data) { |
| 92 | SWIFT_LOG(debug) << std::endl; | 92 | SWIFT_LOG(debug); |
| 93 | tlsLayer_->handleDataRead(*data.get()); | 93 | tlsLayer_->handleDataRead(*data.get()); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | void BOSHConnection::handleTLSError(std::shared_ptr<TLSError> error) { | 96 | void BOSHConnection::handleTLSError(std::shared_ptr<TLSError> error) { |
| 97 | SWIFT_LOG(debug) << (error ? error->getMessage() : "Unknown TLS error") << std::endl; | 97 | SWIFT_LOG(debug) << (error ? error->getMessage() : "Unknown TLS error"); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | void BOSHConnection::writeData(const SafeByteArray& data) { | 100 | void BOSHConnection::writeData(const SafeByteArray& data) { |
| @@ -123,7 +123,7 @@ void BOSHConnection::restartStream() { | |||
| 123 | 123 | ||
| 124 | bool BOSHConnection::setClientCertificate(CertificateWithKey::ref cert) { | 124 | bool BOSHConnection::setClientCertificate(CertificateWithKey::ref cert) { |
| 125 | if (tlsLayer_) { | 125 | if (tlsLayer_) { |
| 126 | SWIFT_LOG(debug) << "set client certificate" << std::endl; | 126 | SWIFT_LOG(debug) << "set client certificate"; |
| 127 | return tlsLayer_->setClientCertificate(cert); | 127 | return tlsLayer_->setClientCertificate(cert); |
| 128 | } | 128 | } |
| 129 | else { | 129 | else { |
| @@ -211,7 +211,7 @@ void BOSHConnection::write(const SafeByteArray& data, bool streamRestart, bool t | |||
| 211 | writeData(safeHeader); | 211 | writeData(safeHeader); |
| 212 | pending_ = true; | 212 | pending_ = true; |
| 213 | 213 | ||
| 214 | SWIFT_LOG(debug) << "write data: " << safeByteArrayToString(safeHeader) << std::endl; | 214 | SWIFT_LOG(debug) << "write data: " << safeByteArrayToString(safeHeader); |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | void BOSHConnection::handleConnectFinished(Connection::ref connection) { | 217 | void BOSHConnection::handleConnectFinished(Connection::ref connection) { |
| @@ -275,7 +275,7 @@ void BOSHConnection::startStream(const std::string& to, unsigned long long rid) | |||
| 275 | SafeByteArray safeHeader = createSafeByteArray(header.str()); | 275 | SafeByteArray safeHeader = createSafeByteArray(header.str()); |
| 276 | onBOSHDataWritten(safeHeader); | 276 | onBOSHDataWritten(safeHeader); |
| 277 | writeData(safeHeader); | 277 | writeData(safeHeader); |
| 278 | SWIFT_LOG(debug) << "write stream header: " << safeByteArrayToString(safeHeader) << std::endl; | 278 | SWIFT_LOG(debug) << "write stream header: " << safeByteArrayToString(safeHeader); |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | void BOSHConnection::handleDataRead(std::shared_ptr<SafeByteArray> data) { | 281 | void BOSHConnection::handleDataRead(std::shared_ptr<SafeByteArray> data) { |
diff --git a/Swiften/Network/BOSHConnectionPool.cpp b/Swiften/Network/BOSHConnectionPool.cpp index 8a75e81..3a79a16 100644 --- a/Swiften/Network/BOSHConnectionPool.cpp +++ b/Swiften/Network/BOSHConnectionPool.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2011-2016 Isode Limited. | 2 | * Copyright (c) 2011-2019 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -266,7 +266,7 @@ std::shared_ptr<BOSHConnection> BOSHConnectionPool::createConnection() { | |||
| 266 | 266 | ||
| 267 | if (boshURL.getScheme() == "https") { | 267 | if (boshURL.getScheme() == "https") { |
| 268 | bool success = connection->setClientCertificate(clientCertificate); | 268 | bool success = connection->setClientCertificate(clientCertificate); |
| 269 | SWIFT_LOG(debug) << "setClientCertificate, success: " << success << std::endl; | 269 | SWIFT_LOG(debug) << "setClientCertificate, success: " << success; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | connection->connect(); | 272 | connection->connect(); |
diff --git a/Swiften/Network/BoostConnection.cpp b/Swiften/Network/BoostConnection.cpp index 551363d..6ae6bf6 100644 --- a/Swiften/Network/BoostConnection.cpp +++ b/Swiften/Network/BoostConnection.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2010-2018 Isode Limited. | 2 | * Copyright (c) 2010-2019 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -107,7 +107,7 @@ void BoostConnection::doWrite(const SafeByteArray& data) { | |||
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | void BoostConnection::handleConnectFinished(const boost::system::error_code& error) { | 109 | void BoostConnection::handleConnectFinished(const boost::system::error_code& error) { |
| 110 | SWIFT_LOG(debug) << "Connect finished: " << error << std::endl; | 110 | SWIFT_LOG(debug) << "Connect finished: " << error; |
| 111 | if (!error) { | 111 | if (!error) { |
| 112 | eventLoop->postEvent(boost::bind(boost::ref(onConnectFinished), false), shared_from_this()); | 112 | eventLoop->postEvent(boost::bind(boost::ref(onConnectFinished), false), shared_from_this()); |
| 113 | doRead(); | 113 | doRead(); |
| @@ -126,7 +126,7 @@ void BoostConnection::doRead() { | |||
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | void BoostConnection::handleSocketRead(const boost::system::error_code& error, size_t bytesTransferred) { | 128 | void BoostConnection::handleSocketRead(const boost::system::error_code& error, size_t bytesTransferred) { |
| 129 | SWIFT_LOG(debug) << "Socket read " << error << std::endl; | 129 | SWIFT_LOG(debug) << "Socket read " << error; |
| 130 | if (!error) { | 130 | if (!error) { |
| 131 | readBuffer_->resize(bytesTransferred); | 131 | readBuffer_->resize(bytesTransferred); |
| 132 | eventLoop->postEvent(boost::bind(boost::ref(onDataRead), readBuffer_), shared_from_this()); | 132 | eventLoop->postEvent(boost::bind(boost::ref(onDataRead), readBuffer_), shared_from_this()); |
| @@ -141,7 +141,7 @@ void BoostConnection::handleSocketRead(const boost::system::error_code& error, s | |||
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | void BoostConnection::handleDataWritten(const boost::system::error_code& error) { | 143 | void BoostConnection::handleDataWritten(const boost::system::error_code& error) { |
| 144 | SWIFT_LOG(debug) << "Data written " << error << std::endl; | 144 | SWIFT_LOG(debug) << "Data written " << error; |
| 145 | if (!error) { | 145 | if (!error) { |
| 146 | eventLoop->postEvent(boost::ref(onDataWritten), shared_from_this()); | 146 | eventLoop->postEvent(boost::ref(onDataWritten), shared_from_this()); |
| 147 | } | 147 | } |
diff --git a/Swiften/Network/BoostConnectionServer.cpp b/Swiften/Network/BoostConnectionServer.cpp index 8db9656..dc05172 100644 --- a/Swiften/Network/BoostConnectionServer.cpp +++ b/Swiften/Network/BoostConnectionServer.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2010-2018 Isode Limited. | 2 | * Copyright (c) 2010-2019 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -46,7 +46,7 @@ boost::optional<BoostConnectionServer::Error> BoostConnectionServer::tryStart() | |||
| 46 | if (endpoint.protocol() == boost::asio::ip::tcp::v6()) { | 46 | if (endpoint.protocol() == boost::asio::ip::tcp::v6()) { |
| 47 | boost::system::error_code ec; | 47 | boost::system::error_code ec; |
| 48 | acceptor_->set_option(boost::asio::ip::v6_only(false), ec); | 48 | acceptor_->set_option(boost::asio::ip::v6_only(false), ec); |
| 49 | SWIFT_LOG_ASSERT(ec, warning) << "IPv4/IPv6 dual-stack support is not supported on this platform." << std::endl; | 49 | SWIFT_LOG_ASSERT(ec, warning) << "IPv4/IPv6 dual-stack support is not supported on this platform."; |
| 50 | } | 50 | } |
| 51 | acceptNextConnection(); | 51 | acceptNextConnection(); |
| 52 | } | 52 | } |
diff --git a/Swiften/Network/ChainedConnector.cpp b/Swiften/Network/ChainedConnector.cpp index 94899ad..a9210ba 100644 --- a/Swiften/Network/ChainedConnector.cpp +++ b/Swiften/Network/ChainedConnector.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2011-2018 Isode Limited. | 2 | * Copyright (c) 2011-2019 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -45,7 +45,7 @@ void ChainedConnector::setTimeoutMilliseconds(int milliseconds) { | |||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | void ChainedConnector::start() { | 47 | void ChainedConnector::start() { |
| 48 | SWIFT_LOG(debug) << "Starting queued connector for " << hostname << std::endl; | 48 | SWIFT_LOG(debug) << "Starting queued connector for " << hostname; |
| 49 | 49 | ||
| 50 | connectionFactoryQueue = std::deque<ConnectionFactory*>(connectionFactories.begin(), connectionFactories.end()); | 50 | connectionFactoryQueue = std::deque<ConnectionFactory*>(connectionFactories.begin(), connectionFactories.end()); |
| 51 | tryNextConnectionFactory(); | 51 | tryNextConnectionFactory(); |
| @@ -63,12 +63,12 @@ void ChainedConnector::stop() { | |||
| 63 | void ChainedConnector::tryNextConnectionFactory() { | 63 | void ChainedConnector::tryNextConnectionFactory() { |
| 64 | assert(!currentConnector); | 64 | assert(!currentConnector); |
| 65 | if (connectionFactoryQueue.empty()) { | 65 | if (connectionFactoryQueue.empty()) { |
| 66 | SWIFT_LOG(debug) << "No more connection factories" << std::endl; | 66 | SWIFT_LOG(debug) << "No more connection factories"; |
| 67 | finish(std::shared_ptr<Connection>(), lastError); | 67 | finish(std::shared_ptr<Connection>(), lastError); |
| 68 | } | 68 | } |
| 69 | else { | 69 | else { |
| 70 | ConnectionFactory* connectionFactory = connectionFactoryQueue.front(); | 70 | ConnectionFactory* connectionFactory = connectionFactoryQueue.front(); |
| 71 | SWIFT_LOG(debug) << "Trying next connection factory: " << typeid(*connectionFactory).name() << std::endl; | 71 | SWIFT_LOG(debug) << "Trying next connection factory: " << typeid(*connectionFactory).name(); |
| 72 | connectionFactoryQueue.pop_front(); | 72 | connectionFactoryQueue.pop_front(); |
| 73 | currentConnector = Connector::create(hostname, port, serviceLookupPrefix, resolver, connectionFactory, timerFactory); | 73 | currentConnector = Connector::create(hostname, port, serviceLookupPrefix, resolver, connectionFactory, timerFactory); |
| 74 | currentConnector->setTimeoutMilliseconds(timeoutMilliseconds); | 74 | currentConnector->setTimeoutMilliseconds(timeoutMilliseconds); |
| @@ -78,7 +78,7 @@ void ChainedConnector::tryNextConnectionFactory() { | |||
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | void ChainedConnector::handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> error) { | 80 | void ChainedConnector::handleConnectorFinished(std::shared_ptr<Connection> connection, std::shared_ptr<Error> error) { |
| 81 | SWIFT_LOG(debug) << "Connector finished" << std::endl; | 81 | SWIFT_LOG(debug) << "Connector finished"; |
| 82 | currentConnector->onConnectFinished.disconnect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1, _2)); | 82 | currentConnector->onConnectFinished.disconnect(boost::bind(&ChainedConnector::handleConnectorFinished, this, _1, _2)); |
| 83 | lastError = error; | 83 | lastError = error; |
| 84 | currentConnector.reset(); | 84 | currentConnector.reset(); |
diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp index a0e6b23..e27b95d 100644 --- a/Swiften/Network/Connector.cpp +++ b/Swiften/Network/Connector.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2010-2018 Isode Limited. | 2 | * Copyright (c) 2010-2019 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -25,7 +25,7 @@ void Connector::setTimeoutMilliseconds(int milliseconds) { | |||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | void Connector::start() { | 27 | void Connector::start() { |
| 28 | SWIFT_LOG(debug) << "Starting connector for " << hostname << std::endl; | 28 | SWIFT_LOG(debug) << "Starting connector for " << hostname; |
| 29 | assert(!currentConnection); | 29 | assert(!currentConnection); |
| 30 | assert(!serviceQuery); | 30 | assert(!serviceQuery); |
| 31 | assert(!timer); | 31 | assert(!timer); |
| @@ -66,7 +66,7 @@ void Connector::queryAddress(const std::string& hostname) { | |||
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | void Connector::handleServiceQueryResult(const std::vector<DomainNameServiceQuery::Result>& result) { | 68 | void Connector::handleServiceQueryResult(const std::vector<DomainNameServiceQuery::Result>& result) { |
| 69 | SWIFT_LOG(debug) << result.size() << " SRV result(s)" << std::endl; | 69 | SWIFT_LOG(debug) << result.size() << " SRV result(s)"; |
| 70 | serviceQueryResults = std::deque<DomainNameServiceQuery::Result>(result.begin(), result.end()); | 70 | serviceQueryResults = std::deque<DomainNameServiceQuery::Result>(result.begin(), result.end()); |
| 71 | serviceQuery.reset(); | 71 | serviceQuery.reset(); |
| 72 | if (!serviceQueryResults.empty()) { | 72 | if (!serviceQueryResults.empty()) { |
| @@ -77,23 +77,23 @@ void Connector::handleServiceQueryResult(const std::vector<DomainNameServiceQuer | |||
| 77 | 77 | ||
| 78 | void Connector::tryNextServiceOrFallback() { | 78 | void Connector::tryNextServiceOrFallback() { |
| 79 | if (queriedAllServices) { | 79 | if (queriedAllServices) { |
| 80 | SWIFT_LOG(debug) << "Queried all services" << std::endl; | 80 | SWIFT_LOG(debug) << "Queried all services"; |
| 81 | finish(std::shared_ptr<Connection>()); | 81 | finish(std::shared_ptr<Connection>()); |
| 82 | } | 82 | } |
| 83 | else if (serviceQueryResults.empty()) { | 83 | else if (serviceQueryResults.empty()) { |
| 84 | SWIFT_LOG(debug) << "Falling back on A resolution" << std::endl; | 84 | SWIFT_LOG(debug) << "Falling back on A resolution"; |
| 85 | // Fall back on simple address resolving | 85 | // Fall back on simple address resolving |
| 86 | queriedAllServices = true; | 86 | queriedAllServices = true; |
| 87 | queryAddress(hostname); | 87 | queryAddress(hostname); |
| 88 | } | 88 | } |
| 89 | else { | 89 | else { |
| 90 | SWIFT_LOG(debug) << "Querying next address" << std::endl; | 90 | SWIFT_LOG(debug) << "Querying next address"; |
| 91 | queryAddress(serviceQueryResults.front().hostname); | 91 | queryAddress(serviceQueryResults.front().hostname); |
| 92 | } | 92 | } |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | void Connector::handleAddressQueryResult(const std::vector<HostAddress>& addresses, boost::optional<DomainNameResolveError> error) { | 95 | void Connector::handleAddressQueryResult(const std::vector<HostAddress>& addresses, boost::optional<DomainNameResolveError> error) { |
| 96 | SWIFT_LOG(debug) << addresses.size() << " addresses" << std::endl; | 96 | SWIFT_LOG(debug) << addresses.size() << " addresses"; |
| 97 | addressQuery.reset(); | 97 | addressQuery.reset(); |
| 98 | if (error || addresses.empty()) { | 98 | if (error || addresses.empty()) { |
| 99 | if (!serviceQueryResults.empty()) { | 99 | if (!serviceQueryResults.empty()) { |
| @@ -110,7 +110,7 @@ void Connector::handleAddressQueryResult(const std::vector<HostAddress>& address | |||
| 110 | 110 | ||
| 111 | void Connector::tryNextAddress() { | 111 | void Connector::tryNextAddress() { |
| 112 | if (addressQueryResults.empty()) { | 112 | if (addressQueryResults.empty()) { |
| 113 | SWIFT_LOG(debug) << "Done trying addresses. Moving on." << std::endl; | 113 | SWIFT_LOG(debug) << "Done trying addresses. Moving on."; |
| 114 | // Done trying all addresses. Move on to the next host. | 114 | // Done trying all addresses. Move on to the next host. |
| 115 | if (!serviceQueryResults.empty()) { | 115 | if (!serviceQueryResults.empty()) { |
| 116 | serviceQueryResults.pop_front(); | 116 | serviceQueryResults.pop_front(); |
| @@ -118,7 +118,7 @@ void Connector::tryNextAddress() { | |||
| 118 | tryNextServiceOrFallback(); | 118 | tryNextServiceOrFallback(); |
| 119 | } | 119 | } |
| 120 | else { | 120 | else { |
| 121 | SWIFT_LOG(debug) << "Trying next address" << std::endl; | 121 | SWIFT_LOG(debug) << "Trying next address"; |
| 122 | HostAddress address = addressQueryResults.front(); | 122 | HostAddress address = addressQueryResults.front(); |
| 123 | addressQueryResults.pop_front(); | 123 | addressQueryResults.pop_front(); |
| 124 | 124 | ||
| @@ -133,7 +133,7 @@ void Connector::tryNextAddress() { | |||
| 133 | 133 | ||
| 134 | void Connector::tryConnect(const HostAddressPort& target) { | 134 | void Connector::tryConnect(const HostAddressPort& target) { |
| 135 | assert(!currentConnection); | 135 | assert(!currentConnection); |
| 136 | SWIFT_LOG(debug) << "Trying to connect to " << target.getAddress().toString() << ":" << target.getPort() << std::endl; | 136 | SWIFT_LOG(debug) << "Trying to connect to " << target.getAddress().toString() << ":" << target.getPort(); |
| 137 | currentConnection = connectionFactory->createConnection(); | 137 | currentConnection = connectionFactory->createConnection(); |
| 138 | currentConnection->onConnectFinished.connect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1)); | 138 | currentConnection->onConnectFinished.connect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1)); |
| 139 | currentConnection->connect(target); | 139 | currentConnection->connect(target); |
| @@ -143,7 +143,7 @@ void Connector::tryConnect(const HostAddressPort& target) { | |||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | void Connector::handleConnectionConnectFinished(bool error) { | 145 | void Connector::handleConnectionConnectFinished(bool error) { |
| 146 | SWIFT_LOG(debug) << "ConnectFinished: " << (error ? "error" : "success") << std::endl; | 146 | SWIFT_LOG(debug) << "ConnectFinished: " << (error ? "error" : "success"); |
| 147 | if (timer) { | 147 | if (timer) { |
| 148 | timer->stop(); | 148 | timer->stop(); |
| 149 | timer.reset(); | 149 | timer.reset(); |
| @@ -195,8 +195,8 @@ void Connector::finish(std::shared_ptr<Connection> connection) { | |||
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | void Connector::handleTimeout() { | 197 | void Connector::handleTimeout() { |
| 198 | SWIFT_LOG(debug) << "Timeout" << std::endl; | 198 | SWIFT_LOG(debug) << "Timeout"; |
| 199 | SWIFT_LOG_ASSERT(currentConnection, error) << "Connection not valid but triggered a timeout" <<std::endl; | 199 | SWIFT_LOG_ASSERT(currentConnection, error) << "Connection not valid but triggered a timeout"; |
| 200 | handleConnectionConnectFinished(true); | 200 | handleConnectionConnectFinished(true); |
| 201 | } | 201 | } |
| 202 | 202 | ||
diff --git a/Swiften/Network/EnvironmentProxyProvider.cpp b/Swiften/Network/EnvironmentProxyProvider.cpp index 65cf4ff..6fbf373 100644 --- a/Swiften/Network/EnvironmentProxyProvider.cpp +++ b/Swiften/Network/EnvironmentProxyProvider.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (c) 2016 Isode Limited. | 8 | * Copyright (c) 2016-2019 Isode Limited. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * See the COPYING file for more information. | 10 | * See the COPYING file for more information. |
| 11 | */ | 11 | */ |
| @@ -26,7 +26,7 @@ namespace Swift { | |||
| 26 | EnvironmentProxyProvider::EnvironmentProxyProvider() { | 26 | EnvironmentProxyProvider::EnvironmentProxyProvider() { |
| 27 | socksProxy = getFromEnv("all_proxy", "socks"); | 27 | socksProxy = getFromEnv("all_proxy", "socks"); |
| 28 | httpProxy = getFromEnv("http_proxy", "http"); | 28 | httpProxy = getFromEnv("http_proxy", "http"); |
| 29 | SWIFT_LOG(debug) << "Environment: SOCKS5 => " << socksProxy.toString() << "; HTTP Connect => " << httpProxy.toString() << std::endl; | 29 | SWIFT_LOG(debug) << "Environment: SOCKS5 => " << socksProxy.toString() << "; HTTP Connect => " << httpProxy.toString(); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | HostAddressPort EnvironmentProxyProvider::getHTTPConnectProxy() const { | 32 | HostAddressPort EnvironmentProxyProvider::getHTTPConnectProxy() const { |
diff --git a/Swiften/Network/GConfProxyProvider.cpp b/Swiften/Network/GConfProxyProvider.cpp index 7c31868..a2f8adc 100644 --- a/Swiften/Network/GConfProxyProvider.cpp +++ b/Swiften/Network/GConfProxyProvider.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (c) 2016-2018 Isode Limited. | 8 | * Copyright (c) 2016-2019 Isode Limited. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * See the COPYING file for more information. | 10 | * See the COPYING file for more information. |
| 11 | */ | 11 | */ |
| @@ -39,7 +39,7 @@ GConfProxyProvider::GConfProxyProvider() { | |||
| 39 | 39 | ||
| 40 | socksProxy = getFromGConf("/system/proxy/socks_host", "/system/proxy/socks_port"); | 40 | socksProxy = getFromGConf("/system/proxy/socks_host", "/system/proxy/socks_port"); |
| 41 | httpProxy = getFromGConf("/system/http_proxy/host", "/system/http_proxy/port"); | 41 | httpProxy = getFromGConf("/system/http_proxy/host", "/system/http_proxy/port"); |
| 42 | SWIFT_LOG(debug) << "GConf: SOCKS5 => " << socksProxy.toString() << "; HTTP Connect => " << httpProxy.toString() << std::endl; | 42 | SWIFT_LOG(debug) << "GConf: SOCKS5 => " << socksProxy.toString() << "; HTTP Connect => " << httpProxy.toString(); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | HostAddressPort GConfProxyProvider::getHTTPConnectProxy() const { | 45 | HostAddressPort GConfProxyProvider::getHTTPConnectProxy() const { |
diff --git a/Swiften/Network/HTTPConnectProxiedConnection.cpp b/Swiften/Network/HTTPConnectProxiedConnection.cpp index 8eba49e..e63b8e2 100644 --- a/Swiften/Network/HTTPConnectProxiedConnection.cpp +++ b/Swiften/Network/HTTPConnectProxiedConnection.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (c) 2011-2018 Isode Limited. | 8 | * Copyright (c) 2011-2019 Isode Limited. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * See the COPYING file for more information. | 10 | * See the COPYING file for more information. |
| 11 | */ | 11 | */ |
| @@ -77,7 +77,7 @@ void HTTPConnectProxiedConnection::initializeProxy() { | |||
| 77 | nextHTTPRequestHeaders_.clear(); | 77 | nextHTTPRequestHeaders_.clear(); |
| 78 | } | 78 | } |
| 79 | append(data, createSafeByteArray("\r\n")); | 79 | append(data, createSafeByteArray("\r\n")); |
| 80 | SWIFT_LOG(debug) << "HTTP Proxy send headers: " << byteArrayToString(ByteArray(data.begin(), data.end())) << std::endl; | 80 | SWIFT_LOG(debug) << "HTTP Proxy send headers: " << byteArrayToString(ByteArray(data.begin(), data.end())); |
| 81 | write(data); | 81 | write(data); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| @@ -111,7 +111,7 @@ void HTTPConnectProxiedConnection::sendHTTPRequest(const std::string& statusLine | |||
| 111 | 111 | ||
| 112 | void HTTPConnectProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByteArray> data) { | 112 | void HTTPConnectProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByteArray> data) { |
| 113 | std::string dataString = byteArrayToString(ByteArray(data->begin(), data->end())); | 113 | std::string dataString = byteArrayToString(ByteArray(data->begin(), data->end())); |
| 114 | SWIFT_LOG(debug) << data << std::endl; | 114 | SWIFT_LOG(debug) << data; |
| 115 | httpResponseBuffer_.append(dataString); | 115 | httpResponseBuffer_.append(dataString); |
| 116 | 116 | ||
| 117 | std::string statusLine; | 117 | std::string statusLine; |
| @@ -141,17 +141,17 @@ void HTTPConnectProxiedConnection::handleProxyInitializeData(std::shared_ptr<Saf | |||
| 141 | if (tmp.size() > 1) { | 141 | if (tmp.size() > 1) { |
| 142 | try { | 142 | try { |
| 143 | int status = boost::lexical_cast<int>(tmp[1]); | 143 | int status = boost::lexical_cast<int>(tmp[1]); |
| 144 | SWIFT_LOG(debug) << "Proxy Status: " << status << std::endl; | 144 | SWIFT_LOG(debug) << "Proxy Status: " << status; |
| 145 | if (status / 100 == 2) { // all 2XX states are OK | 145 | if (status / 100 == 2) { // all 2XX states are OK |
| 146 | setProxyInitializeFinished(true); | 146 | setProxyInitializeFinished(true); |
| 147 | } | 147 | } |
| 148 | else { | 148 | else { |
| 149 | SWIFT_LOG(debug) << "HTTP Proxy returned an error: " << httpResponseBuffer_ << std::endl; | 149 | SWIFT_LOG(debug) << "HTTP Proxy returned an error: " << httpResponseBuffer_; |
| 150 | setProxyInitializeFinished(false); | 150 | setProxyInitializeFinished(false); |
| 151 | } | 151 | } |
| 152 | } | 152 | } |
| 153 | catch (boost::bad_lexical_cast&) { | 153 | catch (boost::bad_lexical_cast&) { |
| 154 | SWIFT_LOG(warning) << "Unexpected response: " << tmp[1] << std::endl; | 154 | SWIFT_LOG(warning) << "Unexpected response: " << tmp[1]; |
| 155 | setProxyInitializeFinished(false); | 155 | setProxyInitializeFinished(false); |
| 156 | } | 156 | } |
| 157 | } | 157 | } |
diff --git a/Swiften/Network/HostAddress.cpp b/Swiften/Network/HostAddress.cpp index 6eca80b..e82f433 100644 --- a/Swiften/Network/HostAddress.cpp +++ b/Swiften/Network/HostAddress.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2010-2016 Isode Limited. | 2 | * Copyright (c) 2010-2019 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -43,7 +43,7 @@ std::string HostAddress::toString() const { | |||
| 43 | 43 | ||
| 44 | addressString = address_.to_string(errorCode); | 44 | addressString = address_.to_string(errorCode); |
| 45 | if (errorCode) { | 45 | if (errorCode) { |
| 46 | SWIFT_LOG(debug) << "error: " << errorCode.message() << std::endl; | 46 | SWIFT_LOG(debug) << "error: " << errorCode.message(); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | return addressString; | 49 | return addressString; |
diff --git a/Swiften/Network/NATPMPInterface.cpp b/Swiften/Network/NATPMPInterface.cpp index 0c33c1f..e20fecd 100644 --- a/Swiften/Network/NATPMPInterface.cpp +++ b/Swiften/Network/NATPMPInterface.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (c) 2014-2018 Isode Limited. | 8 | * Copyright (c) 2014-2019 Isode Limited. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * See the COPYING file for more information. | 10 | * See the COPYING file for more information. |
| 11 | */ | 11 | */ |
| @@ -42,7 +42,7 @@ bool NATPMPInterface::isAvailable() { | |||
| 42 | 42 | ||
| 43 | boost::optional<HostAddress> NATPMPInterface::getPublicIP() { | 43 | boost::optional<HostAddress> NATPMPInterface::getPublicIP() { |
| 44 | if (sendpublicaddressrequest(&p->natpmp) < 0) { | 44 | if (sendpublicaddressrequest(&p->natpmp) < 0) { |
| 45 | SWIFT_LOG(debug) << "Failed to send NAT-PMP public address request!" << std::endl; | 45 | SWIFT_LOG(debug) << "Failed to send NAT-PMP public address request!"; |
| 46 | return boost::optional<HostAddress>(); | 46 | return boost::optional<HostAddress>(); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| @@ -67,7 +67,7 @@ boost::optional<HostAddress> NATPMPInterface::getPublicIP() { | |||
| 67 | return boost::optional<HostAddress>(HostAddress(reinterpret_cast<const unsigned char*>(&(response.pnu.publicaddress.addr)), 4)); | 67 | return boost::optional<HostAddress>(HostAddress(reinterpret_cast<const unsigned char*>(&(response.pnu.publicaddress.addr)), 4)); |
| 68 | } | 68 | } |
| 69 | else { | 69 | else { |
| 70 | SWIFT_LOG(debug) << "Inavlid NAT-PMP response." << std::endl; | 70 | SWIFT_LOG(debug) << "Inavlid NAT-PMP response."; |
| 71 | return boost::optional<HostAddress>(); | 71 | return boost::optional<HostAddress>(); |
| 72 | } | 72 | } |
| 73 | } | 73 | } |
| @@ -80,7 +80,7 @@ boost::optional<NATPortMapping> NATPMPInterface::addPortForward(unsigned short l | |||
| 80 | mapping.getLocalPort(), | 80 | mapping.getLocalPort(), |
| 81 | mapping.getPublicPort(), | 81 | mapping.getPublicPort(), |
| 82 | mapping.getLeaseInSeconds()) < 0) { | 82 | mapping.getLeaseInSeconds()) < 0) { |
| 83 | SWIFT_LOG(debug) << "Failed to send NAT-PMP port forwarding request!" << std::endl; | 83 | SWIFT_LOG(debug) << "Failed to send NAT-PMP port forwarding request!"; |
| 84 | return boost::optional<NATPortMapping>(); | 84 | return boost::optional<NATPortMapping>(); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| @@ -106,14 +106,14 @@ boost::optional<NATPortMapping> NATPMPInterface::addPortForward(unsigned short l | |||
| 106 | return result; | 106 | return result; |
| 107 | } | 107 | } |
| 108 | else { | 108 | else { |
| 109 | SWIFT_LOG(debug) << "Invalid NAT-PMP response." << std::endl; | 109 | SWIFT_LOG(debug) << "Invalid NAT-PMP response."; |
| 110 | return boost::optional<NATPortMapping>(); | 110 | return boost::optional<NATPortMapping>(); |
| 111 | } | 111 | } |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | bool NATPMPInterface::removePortForward(const NATPortMapping& mapping) { | 114 | bool NATPMPInterface::removePortForward(const NATPortMapping& mapping) { |
| 115 | if (sendnewportmappingrequest(&p->natpmp, mapping.getProtocol() == NATPortMapping::TCP ? NATPMP_PROTOCOL_TCP : NATPMP_PROTOCOL_UDP, mapping.getLocalPort(), 0, 0) < 0) { | 115 | if (sendnewportmappingrequest(&p->natpmp, mapping.getProtocol() == NATPortMapping::TCP ? NATPMP_PROTOCOL_TCP : NATPMP_PROTOCOL_UDP, mapping.getLocalPort(), 0, 0) < 0) { |
| 116 | SWIFT_LOG(debug) << "Failed to send NAT-PMP remove forwarding request!" << std::endl; | 116 | SWIFT_LOG(debug) << "Failed to send NAT-PMP remove forwarding request!"; |
| 117 | return false; | 117 | return false; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| @@ -133,7 +133,7 @@ bool NATPMPInterface::removePortForward(const NATPortMapping& mapping) { | |||
| 133 | return true; | 133 | return true; |
| 134 | } | 134 | } |
| 135 | else { | 135 | else { |
| 136 | SWIFT_LOG(debug) << "Invalid NAT-PMP response." << std::endl; | 136 | SWIFT_LOG(debug) << "Invalid NAT-PMP response."; |
| 137 | return false; | 137 | return false; |
| 138 | } | 138 | } |
| 139 | } | 139 | } |
diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.cpp b/Swiften/Network/PlatformDomainNameServiceQuery.cpp index f884500..2ff14e1 100644 --- a/Swiften/Network/PlatformDomainNameServiceQuery.cpp +++ b/Swiften/Network/PlatformDomainNameServiceQuery.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2010-2018 Isode Limited. | 2 | * Copyright (c) 2010-2019 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -58,7 +58,7 @@ void PlatformDomainNameServiceQuery::runBlocking() { | |||
| 58 | return; | 58 | return; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | SWIFT_LOG(debug) << "Querying " << service << std::endl; | 61 | SWIFT_LOG(debug) << "Querying " << service; |
| 62 | 62 | ||
| 63 | std::vector<DomainNameServiceQuery::Result> records; | 63 | std::vector<DomainNameServiceQuery::Result> records; |
| 64 | 64 | ||
| @@ -97,7 +97,7 @@ void PlatformDomainNameServiceQuery::runBlocking() { | |||
| 97 | response.resize(NS_PACKETSZ); | 97 | response.resize(NS_PACKETSZ); |
| 98 | int responseLength = res_query(const_cast<char*>(service.c_str()), ns_c_in, ns_t_srv, reinterpret_cast<u_char*>(vecptr(response)), response.size()); | 98 | int responseLength = res_query(const_cast<char*>(service.c_str()), ns_c_in, ns_t_srv, reinterpret_cast<u_char*>(vecptr(response)), response.size()); |
| 99 | if (responseLength == -1) { | 99 | if (responseLength == -1) { |
| 100 | SWIFT_LOG(debug) << "Error" << std::endl; | 100 | SWIFT_LOG(debug) << "Error"; |
| 101 | emitError(); | 101 | emitError(); |
| 102 | return; | 102 | return; |
| 103 | } | 103 | } |
diff --git a/Swiften/Network/PlatformNATTraversalWorker.cpp b/Swiften/Network/PlatformNATTraversalWorker.cpp index 041ad2d..5431379 100644 --- a/Swiften/Network/PlatformNATTraversalWorker.cpp +++ b/Swiften/Network/PlatformNATTraversalWorker.cpp | |||
| @@ -157,7 +157,7 @@ NATTraversalInterface* PlatformNATTraversalWorker::getNATTraversalInterface() co | |||
| 157 | miniUPnPInterface = new MiniUPnPInterface(); | 157 | miniUPnPInterface = new MiniUPnPInterface(); |
| 158 | miniUPnPSupported = miniUPnPInterface->isAvailable(); | 158 | miniUPnPSupported = miniUPnPInterface->isAvailable(); |
| 159 | } | 159 | } |
| 160 | SWIFT_LOG(debug) << "UPnP NAT traversal supported: " << static_cast<bool>(miniUPnPSupported) << std::endl; | 160 | SWIFT_LOG(debug) << "UPnP NAT traversal supported: " << static_cast<bool>(miniUPnPSupported); |
| 161 | if (miniUPnPSupported) { | 161 | if (miniUPnPSupported) { |
| 162 | return miniUPnPInterface; | 162 | return miniUPnPInterface; |
| 163 | } | 163 | } |
| @@ -168,7 +168,7 @@ NATTraversalInterface* PlatformNATTraversalWorker::getNATTraversalInterface() co | |||
| 168 | natPMPInterface = new NATPMPInterface(); | 168 | natPMPInterface = new NATPMPInterface(); |
| 169 | natPMPSupported = natPMPInterface->isAvailable(); | 169 | natPMPSupported = natPMPInterface->isAvailable(); |
| 170 | } | 170 | } |
| 171 | SWIFT_LOG(debug) << "NAT-PMP NAT traversal supported: " << static_cast<bool>(natPMPSupported) << std::endl; | 171 | SWIFT_LOG(debug) << "NAT-PMP NAT traversal supported: " << static_cast<bool>(natPMPSupported); |
| 172 | if (natPMPSupported) { | 172 | if (natPMPSupported) { |
| 173 | return natPMPInterface; | 173 | return natPMPInterface; |
| 174 | } | 174 | } |
diff --git a/Swiften/Network/ProxiedConnection.cpp b/Swiften/Network/ProxiedConnection.cpp index 4c97e31..0c5cda6 100644 --- a/Swiften/Network/ProxiedConnection.cpp +++ b/Swiften/Network/ProxiedConnection.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2012-2018 Isode Limited. | 2 | * Copyright (c) 2012-2019 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -37,7 +37,7 @@ ProxiedConnection::~ProxiedConnection() { | |||
| 37 | connection_->onDisconnected.disconnect(boost::bind(&ProxiedConnection::handleDisconnected, shared_from_this(), _1)); | 37 | connection_->onDisconnected.disconnect(boost::bind(&ProxiedConnection::handleDisconnected, shared_from_this(), _1)); |
| 38 | } | 38 | } |
| 39 | if (connected_) { | 39 | if (connected_) { |
| 40 | SWIFT_LOG(warning) << "Connection was still established." << std::endl; | 40 | SWIFT_LOG(warning) << "Connection was still established."; |
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| 43 | 43 | ||
diff --git a/Swiften/Network/SOCKS5ProxiedConnection.cpp b/Swiften/Network/SOCKS5ProxiedConnection.cpp index d7036f2..c76b6e6 100644 --- a/Swiften/Network/SOCKS5ProxiedConnection.cpp +++ b/Swiften/Network/SOCKS5ProxiedConnection.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * Copyright (c) 2014-2018 Isode Limited. | 8 | * Copyright (c) 2014-2019 Isode Limited. |
| 9 | * All rights reserved. | 9 | * All rights reserved. |
| 10 | * See the COPYING file for more information. | 10 | * See the COPYING file for more information. |
| 11 | */ | 11 | */ |
| @@ -50,7 +50,7 @@ void SOCKS5ProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByte | |||
| 50 | assert(rawAddress.is_v4() || rawAddress.is_v6()); | 50 | assert(rawAddress.is_v4() || rawAddress.is_v6()); |
| 51 | 51 | ||
| 52 | if (proxyState_ == ProxyAuthenticating) { | 52 | if (proxyState_ == ProxyAuthenticating) { |
| 53 | SWIFT_LOG(debug) << "ProxyAuthenticating response received, reply with the connect BYTEs" << std::endl; | 53 | SWIFT_LOG(debug) << "ProxyAuthenticating response received, reply with the connect BYTEs"; |
| 54 | unsigned char choosenMethod = static_cast<unsigned char> ((*data)[1]); | 54 | unsigned char choosenMethod = static_cast<unsigned char> ((*data)[1]); |
| 55 | if ((*data)[0] == 0x05 && choosenMethod != 0xFF) { | 55 | if ((*data)[0] == 0x05 && choosenMethod != 0xFF) { |
| 56 | switch(choosenMethod) { // use the correct Method | 56 | switch(choosenMethod) { // use the correct Method |
| @@ -79,7 +79,7 @@ void SOCKS5ProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByte | |||
| 79 | return; | 79 | return; |
| 80 | } | 80 | } |
| 81 | catch(...) { | 81 | catch(...) { |
| 82 | SWIFT_LOG(error) << "exception caught" << std::endl; | 82 | SWIFT_LOG(error) << "exception caught"; |
| 83 | } | 83 | } |
| 84 | write(socksConnect); | 84 | write(socksConnect); |
| 85 | break; | 85 | break; |
| @@ -92,8 +92,8 @@ void SOCKS5ProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByte | |||
| 92 | setProxyInitializeFinished(false); | 92 | setProxyInitializeFinished(false); |
| 93 | } | 93 | } |
| 94 | else if (proxyState_ == ProxyConnecting) { | 94 | else if (proxyState_ == ProxyConnecting) { |
| 95 | SWIFT_LOG(debug) << "Connect response received, check if successfully." << std::endl; | 95 | SWIFT_LOG(debug) << "Connect response received, check if successfully."; |
| 96 | SWIFT_LOG(debug) << "Errorbyte: 0x" << std::hex << static_cast<int> ((*data)[1]) << std::dec << std::endl; | 96 | SWIFT_LOG(debug) << "Errorbyte: 0x" << std::hex << static_cast<int> ((*data)[1]) << std::dec; |
| 97 | /* | 97 | /* |
| 98 | 98 | ||
| 99 | data.at(1) can be one of the following: | 99 | data.at(1) can be one of the following: |
| @@ -109,11 +109,11 @@ void SOCKS5ProxiedConnection::handleProxyInitializeData(std::shared_ptr<SafeByte | |||
| 109 | 0x09 bis 0xFF unassigned | 109 | 0x09 bis 0xFF unassigned |
| 110 | */ | 110 | */ |
| 111 | if ((*data)[0] == 0x05 && (*data)[1] == 0x0) { | 111 | if ((*data)[0] == 0x05 && (*data)[1] == 0x0) { |
| 112 | SWIFT_LOG(debug) << "Successfully connected the server via the proxy." << std::endl; | 112 | SWIFT_LOG(debug) << "Successfully connected the server via the proxy."; |
| 113 | setProxyInitializeFinished(true); | 113 | setProxyInitializeFinished(true); |
| 114 | } | 114 | } |
| 115 | else { | 115 | else { |
| 116 | SWIFT_LOG(error) << "SOCKS Proxy returned an error: " << std::hex << (*data)[1] << std::endl; | 116 | SWIFT_LOG(error) << "SOCKS Proxy returned an error: " << std::hex << (*data)[1]; |
| 117 | setProxyInitializeFinished(false); | 117 | setProxyInitializeFinished(false); |
| 118 | } | 118 | } |
| 119 | } | 119 | } |
diff --git a/Swiften/Network/UnboundDomainNameResolver.cpp b/Swiften/Network/UnboundDomainNameResolver.cpp index 1df6b8f..21bc697 100644 --- a/Swiften/Network/UnboundDomainNameResolver.cpp +++ b/Swiften/Network/UnboundDomainNameResolver.cpp | |||
| @@ -64,7 +64,7 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo | |||
| 64 | 1 /* CLASS IN (internet) */, | 64 | 1 /* CLASS IN (internet) */, |
| 65 | helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL); | 65 | helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL); |
| 66 | if(retval != 0) { | 66 | if(retval != 0) { |
| 67 | SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval) << std::endl; | 67 | SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval); |
| 68 | delete helper; | 68 | delete helper; |
| 69 | } | 69 | } |
| 70 | } | 70 | } |
| @@ -73,7 +73,7 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo | |||
| 73 | std::vector<DomainNameServiceQuery::Result> serviceRecords; | 73 | std::vector<DomainNameServiceQuery::Result> serviceRecords; |
| 74 | 74 | ||
| 75 | if(err != 0) { | 75 | if(err != 0) { |
| 76 | SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err) << std::endl; | 76 | SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err); |
| 77 | } else { | 77 | } else { |
| 78 | if(result->havedata) { | 78 | if(result->havedata) { |
| 79 | ldns_pkt* replyPacket = 0; | 79 | ldns_pkt* replyPacket = 0; |
| @@ -105,7 +105,7 @@ class UnboundDomainNameServiceQuery : public DomainNameServiceQuery, public Unbo | |||
| 105 | 105 | ||
| 106 | serviceRecord.hostname = std::string(reinterpret_cast<char*>(ldns_buffer_at(buffer, 0))); | 106 | serviceRecord.hostname = std::string(reinterpret_cast<char*>(ldns_buffer_at(buffer, 0))); |
| 107 | serviceRecords.push_back(serviceRecord); | 107 | serviceRecords.push_back(serviceRecord); |
| 108 | SWIFT_LOG(debug) << "hostname " << serviceRecord.hostname << " added" << std::endl; | 108 | SWIFT_LOG(debug) << "hostname " << serviceRecord.hostname << " added"; |
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| 111 | if (replyPacket) ldns_pkt_free(replyPacket); | 111 | if (replyPacket) ldns_pkt_free(replyPacket); |
| @@ -137,7 +137,7 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo | |||
| 137 | 1 /* CLASS IN (internet) */, | 137 | 1 /* CLASS IN (internet) */, |
| 138 | helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL); | 138 | helper, UnboundDomainNameResolver::unbound_callback_wrapper, NULL); |
| 139 | if(retval != 0) { | 139 | if(retval != 0) { |
| 140 | SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval) << std::endl; | 140 | SWIFT_LOG(debug) << "resolve error: " << ub_strerror(retval); |
| 141 | delete helper; | 141 | delete helper; |
| 142 | } | 142 | } |
| 143 | } | 143 | } |
| @@ -145,10 +145,10 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo | |||
| 145 | void handleResult(int err, struct ub_result* result) { | 145 | void handleResult(int err, struct ub_result* result) { |
| 146 | std::vector<HostAddress> addresses; | 146 | std::vector<HostAddress> addresses; |
| 147 | boost::optional<DomainNameResolveError> error; | 147 | boost::optional<DomainNameResolveError> error; |
| 148 | SWIFT_LOG(debug) << "Result for: " << name << std::endl; | 148 | SWIFT_LOG(debug) << "Result for: " << name; |
| 149 | 149 | ||
| 150 | if(err != 0) { | 150 | if(err != 0) { |
| 151 | SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err) << std::endl; | 151 | SWIFT_LOG(debug) << "resolve error: " << ub_strerror(err); |
| 152 | error = DomainNameResolveError(); | 152 | error = DomainNameResolveError(); |
| 153 | } else { | 153 | } else { |
| 154 | if(result->havedata) { | 154 | if(result->havedata) { |
| @@ -156,13 +156,13 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo | |||
| 156 | char address[100]; | 156 | char address[100]; |
| 157 | const char* addressStr = 0; | 157 | const char* addressStr = 0; |
| 158 | if ((addressStr = inet_ntop(AF_INET, result->data[i], address, 100))) { | 158 | if ((addressStr = inet_ntop(AF_INET, result->data[i], address, 100))) { |
| 159 | SWIFT_LOG(debug) << "IPv4 address: " << addressStr << std::endl; | 159 | SWIFT_LOG(debug) << "IPv4 address: " << addressStr; |
| 160 | addresses.push_back(HostAddress(std::string(addressStr))); | 160 | addresses.push_back(HostAddress(std::string(addressStr))); |
| 161 | } else if ((addressStr = inet_ntop(AF_INET6, result->data[i], address, 100))) { | 161 | } else if ((addressStr = inet_ntop(AF_INET6, result->data[i], address, 100))) { |
| 162 | SWIFT_LOG(debug) << "IPv6 address: " << addressStr << std::endl; | 162 | SWIFT_LOG(debug) << "IPv6 address: " << addressStr; |
| 163 | addresses.push_back(HostAddress(std::string(addressStr))); | 163 | addresses.push_back(HostAddress(std::string(addressStr))); |
| 164 | } else { | 164 | } else { |
| 165 | SWIFT_LOG(debug) << "inet_ntop() failed" << std::endl; | 165 | SWIFT_LOG(debug) << "inet_ntop() failed"; |
| 166 | error = DomainNameResolveError(); | 166 | error = DomainNameResolveError(); |
| 167 | } | 167 | } |
| 168 | } | 168 | } |
| @@ -182,7 +182,7 @@ class UnboundDomainNameAddressQuery : public DomainNameAddressQuery, public Unbo | |||
| 182 | UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : idnConverter(idnConverter), ioService(ioService), ubDescriptior(*ioService), eventLoop(eventLoop) { | 182 | UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, std::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : idnConverter(idnConverter), ioService(ioService), ubDescriptior(*ioService), eventLoop(eventLoop) { |
| 183 | ubContext = ub_ctx_create(); | 183 | ubContext = ub_ctx_create(); |
| 184 | if(!ubContext) { | 184 | if(!ubContext) { |
| 185 | SWIFT_LOG(debug) << "could not create unbound context" << std::endl; | 185 | SWIFT_LOG(debug) << "could not create unbound context"; |
| 186 | } | 186 | } |
| 187 | eventOwner = std::make_shared<EventOwner>(); | 187 | eventOwner = std::make_shared<EventOwner>(); |
| 188 | 188 | ||
| @@ -192,11 +192,11 @@ UnboundDomainNameResolver::UnboundDomainNameResolver(IDNConverter* idnConverter, | |||
| 192 | 192 | ||
| 193 | /* read /etc/resolv.conf for DNS proxy settings (from DHCP) */ | 193 | /* read /etc/resolv.conf for DNS proxy settings (from DHCP) */ |
| 194 | if( (ret=ub_ctx_resolvconf(ubContext, const_cast<char*>("/etc/resolv.conf"))) != 0) { | 194 | if( (ret=ub_ctx_resolvconf(ubContext, const_cast<char*>("/etc/resolv.conf"))) != 0) { |
| 195 | SWIFT_LOG(error) << "error reading resolv.conf: " << ub_strerror(ret) << ". errno says: " << strerror(errno) << std::endl; | 195 | SWIFT_LOG(error) << "error reading resolv.conf: " << ub_strerror(ret) << ". errno says: " << strerror(errno); |
| 196 | } | 196 | } |
| 197 | /* read /etc/hosts for locally supplied host addresses */ | 197 | /* read /etc/hosts for locally supplied host addresses */ |
| 198 | if( (ret=ub_ctx_hosts(ubContext, const_cast<char*>("/etc/hosts"))) != 0) { | 198 | if( (ret=ub_ctx_hosts(ubContext, const_cast<char*>("/etc/hosts"))) != 0) { |
| 199 | SWIFT_LOG(error) << "error reading hosts: " << ub_strerror(ret) << ". errno says: " << strerror(errno) << std::endl; | 199 | SWIFT_LOG(error) << "error reading hosts: " << ub_strerror(ret) << ". errno says: " << strerror(errno); |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | ubDescriptior.assign(ub_fd(ubContext)); | 202 | ubDescriptior.assign(ub_fd(ubContext)); |
| @@ -231,7 +231,7 @@ void UnboundDomainNameResolver::processData() { | |||
| 231 | if (ub_poll(ubContext)) { | 231 | if (ub_poll(ubContext)) { |
| 232 | int ret = ub_process(ubContext); | 232 | int ret = ub_process(ubContext); |
| 233 | if(ret != 0) { | 233 | if(ret != 0) { |
| 234 | SWIFT_LOG(debug) << "resolve error: " << ub_strerror(ret) << std::endl; | 234 | SWIFT_LOG(debug) << "resolve error: " << ub_strerror(ret); |
| 235 | } | 235 | } |
| 236 | } | 236 | } |
| 237 | } | 237 | } |
diff --git a/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp b/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp index 065d015..e9268b0 100644 --- a/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp +++ b/Swiften/Network/UnitTest/HTTPConnectProxiedConnectionTest.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2010-2018 Isode Limited. | 2 | * Copyright (c) 2010-2019 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -37,7 +37,7 @@ namespace { | |||
| 37 | 37 | ||
| 38 | virtual std::vector<std::pair<std::string, std::string> > filterHTTPResponseHeader(const std::string& /* statusLine */, const std::vector<std::pair<std::string, std::string> >& response) { | 38 | virtual std::vector<std::pair<std::string, std::string> > filterHTTPResponseHeader(const std::string& /* statusLine */, const std::vector<std::pair<std::string, std::string> >& response) { |
| 39 | filterResponses.push_back(response); | 39 | filterResponses.push_back(response); |
| 40 | SWIFT_LOG(debug) << std::endl; | 40 | SWIFT_LOG(debug); |
| 41 | return filterResponseReturn; | 41 | return filterResponseReturn; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| @@ -409,7 +409,7 @@ class HTTPConnectProxiedConnectionTest : public CppUnit::TestFixture { | |||
| 409 | std::shared_ptr<Connection> createConnection() { | 409 | std::shared_ptr<Connection> createConnection() { |
| 410 | std::shared_ptr<MockConnection> connection = std::make_shared<MockConnection>(failingPorts, eventLoop); | 410 | std::shared_ptr<MockConnection> connection = std::make_shared<MockConnection>(failingPorts, eventLoop); |
| 411 | connections.push_back(connection); | 411 | connections.push_back(connection); |
| 412 | SWIFT_LOG(debug) << "new connection created" << std::endl; | 412 | SWIFT_LOG(debug) << "new connection created"; |
| 413 | return connection; | 413 | return connection; |
| 414 | } | 414 | } |
| 415 | 415 | ||
diff --git a/Swiften/Network/WindowsProxyProvider.cpp b/Swiften/Network/WindowsProxyProvider.cpp index 9a60bb4..13fdb25 100644 --- a/Swiften/Network/WindowsProxyProvider.cpp +++ b/Swiften/Network/WindowsProxyProvider.cpp | |||
| @@ -52,7 +52,7 @@ WindowsProxyProvider::WindowsProxyProvider() | |||
| 52 | for(auto&& proxy : proxies) { | 52 | for(auto&& proxy : proxies) { |
| 53 | if(proxy.find('=') != std::string::npos) { | 53 | if(proxy.find('=') != std::string::npos) { |
| 54 | protocolAndProxy = String::getSplittedAtFirst(proxy, '='); | 54 | protocolAndProxy = String::getSplittedAtFirst(proxy, '='); |
| 55 | SWIFT_LOG(debug) << "Found proxy: " << protocolAndProxy.first << " => " << protocolAndProxy.second << std::endl; | 55 | SWIFT_LOG(debug) << "Found proxy: " << protocolAndProxy.first << " => " << protocolAndProxy.second; |
| 56 | if(protocolAndProxy.first.compare("socks") == 0) { | 56 | if(protocolAndProxy.first.compare("socks") == 0) { |
| 57 | socksProxy = getAsHostAddressPort(protocolAndProxy.second); | 57 | socksProxy = getAsHostAddressPort(protocolAndProxy.second); |
| 58 | } | 58 | } |
| @@ -86,7 +86,7 @@ HostAddressPort WindowsProxyProvider::getAsHostAddressPort(std::string proxy) { | |||
| 86 | ret = HostAddressPort(HostAddress::fromString(tmp.first).get(), port); | 86 | ret = HostAddressPort(HostAddress::fromString(tmp.first).get(), port); |
| 87 | } | 87 | } |
| 88 | catch(...) { | 88 | catch(...) { |
| 89 | SWIFT_LOG(error) << "Exception occured while parsing windows proxy \"getHostAddressPort\"." << std::endl; | 89 | SWIFT_LOG(error) << "Exception occured while parsing windows proxy \"getHostAddressPort\"."; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | return ret; | 92 | return ret; |
Swift