summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Mons <edwin.mons@isode.com>2019-11-19 13:36:05 (GMT)
committerEdwin Mons <edwin.mons@isode.com>2019-11-19 13:58:45 (GMT)
commit261ba8d8595ed8cb90f9c4feb1d6ef642942bcba (patch)
treec7e60d473509db8c4dbff5aa83fbde963d8dd75e /Swiften/Network/Connector.cpp
parent697ae6ae84512a744958b24118197ec7bfdbc1f0 (diff)
downloadswift-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/Connector.cpp')
-rw-r--r--Swiften/Network/Connector.cpp26
1 files changed, 13 insertions, 13 deletions
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
27void Connector::start() { 27void 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
68void Connector::handleServiceQueryResult(const std::vector<DomainNameServiceQuery::Result>& result) { 68void 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
78void Connector::tryNextServiceOrFallback() { 78void 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
95void Connector::handleAddressQueryResult(const std::vector<HostAddress>& addresses, boost::optional<DomainNameResolveError> error) { 95void 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
111void Connector::tryNextAddress() { 111void 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
134void Connector::tryConnect(const HostAddressPort& target) { 134void 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
145void Connector::handleConnectionConnectFinished(bool error) { 145void 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
197void Connector::handleTimeout() { 197void 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