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/FileTransfer/SOCKS5BytestreamServerManager.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/FileTransfer/SOCKS5BytestreamServerManager.cpp')
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
index a6b75da..7fc1388 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.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 */
@@ -48,12 +48,12 @@ SOCKS5BytestreamServerManager::SOCKS5BytestreamServerManager(
48} 48}
49 49
50SOCKS5BytestreamServerManager::~SOCKS5BytestreamServerManager() { 50SOCKS5BytestreamServerManager::~SOCKS5BytestreamServerManager() {
51 SWIFT_LOG_ASSERT(!connectionServer, warning) << std::endl; 51 SWIFT_LOG_ASSERT(!connectionServer, warning);
52 SWIFT_LOG_ASSERT(!getPublicIPRequest, warning) << std::endl; 52 SWIFT_LOG_ASSERT(!getPublicIPRequest, warning);
53 SWIFT_LOG_ASSERT(!forwardPortRequest, warning) << std::endl; 53 SWIFT_LOG_ASSERT(!forwardPortRequest, warning);
54 SWIFT_LOG_ASSERT(state == Start, warning) << std::endl; 54 SWIFT_LOG_ASSERT(state == Start, warning);
55 if (portMapping && !unforwardPortRequest) { 55 if (portMapping && !unforwardPortRequest) {
56 SWIFT_LOG(warning) << "Port forwarding still alive. Trying to remove it now." << std::endl; 56 SWIFT_LOG(warning) << "Port forwarding still alive. Trying to remove it now.";
57 unforwardPortRequest = natTraverser->createRemovePortForwardingRequest(portMapping.get().getLocalPort(), portMapping.get().getPublicPort()); 57 unforwardPortRequest = natTraverser->createRemovePortForwardingRequest(portMapping.get().getLocalPort(), portMapping.get().getPublicPort());
58 unforwardPortRequest->start(); 58 unforwardPortRequest->start();
59 } 59 }
@@ -116,25 +116,25 @@ void SOCKS5BytestreamServerManager::initialize() {
116 assert(!connectionServer); 116 assert(!connectionServer);
117 unsigned short port; 117 unsigned short port;
118 for (port = LISTEN_PORTS_BEGIN; port < LISTEN_PORTS_END; ++port) { 118 for (port = LISTEN_PORTS_BEGIN; port < LISTEN_PORTS_END; ++port) {
119 SWIFT_LOG(debug) << "Trying to start server on port " << port << std::endl; 119 SWIFT_LOG(debug) << "Trying to start server on port " << port;
120 connectionServer = connectionServerFactory->createConnectionServer(HostAddress::fromString("::").get(), port); 120 connectionServer = connectionServerFactory->createConnectionServer(HostAddress::fromString("::").get(), port);
121 boost::optional<ConnectionServer::Error> error = connectionServer->tryStart(); 121 boost::optional<ConnectionServer::Error> error = connectionServer->tryStart();
122 if (!error) { 122 if (!error) {
123 break; 123 break;
124 } 124 }
125 else if (*error != ConnectionServer::Conflict) { 125 else if (*error != ConnectionServer::Conflict) {
126 SWIFT_LOG(debug) << "Error starting server" << std::endl; 126 SWIFT_LOG(debug) << "Error starting server";
127 onInitialized(false); 127 onInitialized(false);
128 return; 128 return;
129 } 129 }
130 connectionServer.reset(); 130 connectionServer.reset();
131 } 131 }
132 if (!connectionServer) { 132 if (!connectionServer) {
133 SWIFT_LOG(debug) << "Unable to find an open port" << std::endl; 133 SWIFT_LOG(debug) << "Unable to find an open port";
134 onInitialized(false); 134 onInitialized(false);
135 return; 135 return;
136 } 136 }
137 SWIFT_LOG(debug) << "Server started succesfully" << std::endl; 137 SWIFT_LOG(debug) << "Server started succesfully";
138 connectionServerPort = port; 138 connectionServerPort = port;
139 139
140 // Start bytestream server. Should actually happen before the connectionserver is started 140 // Start bytestream server. Should actually happen before the connectionserver is started
@@ -211,10 +211,10 @@ void SOCKS5BytestreamServerManager::stop() {
211 211
212void SOCKS5BytestreamServerManager::handleGetPublicIPResult(boost::optional<HostAddress> address) { 212void SOCKS5BytestreamServerManager::handleGetPublicIPResult(boost::optional<HostAddress> address) {
213 if (address) { 213 if (address) {
214 SWIFT_LOG(debug) << "Public IP discovered as " << address.get().toString() << "." << std::endl; 214 SWIFT_LOG(debug) << "Public IP discovered as " << address.get().toString() << ".";
215 } 215 }
216 else { 216 else {
217 SWIFT_LOG(debug) << "No public IP discoverable." << std::endl; 217 SWIFT_LOG(debug) << "No public IP discoverable.";
218 } 218 }
219 219
220 publicAddress = address; 220 publicAddress = address;
@@ -225,10 +225,10 @@ void SOCKS5BytestreamServerManager::handleGetPublicIPResult(boost::optional<Host
225 225
226void SOCKS5BytestreamServerManager::handleForwardPortResult(boost::optional<NATPortMapping> mapping) { 226void SOCKS5BytestreamServerManager::handleForwardPortResult(boost::optional<NATPortMapping> mapping) {
227 if (mapping) { 227 if (mapping) {
228 SWIFT_LOG(debug) << "Mapping port was successful." << std::endl; 228 SWIFT_LOG(debug) << "Mapping port was successful.";
229 } 229 }
230 else { 230 else {
231 SWIFT_LOG(debug) << "Mapping port has failed." << std::endl; 231 SWIFT_LOG(debug) << "Mapping port has failed.";
232 } 232 }
233 233
234 portMapping = mapping; 234 portMapping = mapping;
@@ -243,7 +243,7 @@ void SOCKS5BytestreamServerManager::handleUnforwardPortResult(boost::optional<bo
243 portMapping.reset(); 243 portMapping.reset();
244 } 244 }
245 else { 245 else {
246 SWIFT_LOG(warning) << "Failed to remove port forwarding." << std::endl; 246 SWIFT_LOG(warning) << "Failed to remove port forwarding.";
247 } 247 }
248 attemptedPortMapping_ = false; 248 attemptedPortMapping_ = false;
249 unforwardPortRequest.reset(); 249 unforwardPortRequest.reset();