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/FileTransfer/SOCKS5BytestreamServerSession.cpp | |
| 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/FileTransfer/SOCKS5BytestreamServerSession.cpp')
| -rw-r--r-- | Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp index 0fd40bf..a4ab751 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.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 | */ |
| @@ -33,13 +33,13 @@ SOCKS5BytestreamServerSession::SOCKS5BytestreamServerSession( | |||
| 33 | 33 | ||
| 34 | SOCKS5BytestreamServerSession::~SOCKS5BytestreamServerSession() { | 34 | SOCKS5BytestreamServerSession::~SOCKS5BytestreamServerSession() { |
| 35 | if (state != Finished && state != Initial) { | 35 | if (state != Finished && state != Initial) { |
| 36 | SWIFT_LOG(warning) << "SOCKS5BytestreamServerSession unfinished" << std::endl; | 36 | SWIFT_LOG(warning) << "SOCKS5BytestreamServerSession unfinished"; |
| 37 | finish(); | 37 | finish(); |
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | void SOCKS5BytestreamServerSession::start() { | 41 | void SOCKS5BytestreamServerSession::start() { |
| 42 | SWIFT_LOG(debug) << std::endl; | 42 | SWIFT_LOG(debug); |
| 43 | dataReadConnection = connection->onDataRead.connect( | 43 | dataReadConnection = connection->onDataRead.connect( |
| 44 | boost::bind(&SOCKS5BytestreamServerSession::handleDataRead, this, _1)); | 44 | boost::bind(&SOCKS5BytestreamServerSession::handleDataRead, this, _1)); |
| 45 | state = WaitingForAuthentication; | 45 | state = WaitingForAuthentication; |
| @@ -50,7 +50,7 @@ void SOCKS5BytestreamServerSession::stop() { | |||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | void SOCKS5BytestreamServerSession::startSending(std::shared_ptr<ReadBytestream> stream) { | 52 | void SOCKS5BytestreamServerSession::startSending(std::shared_ptr<ReadBytestream> stream) { |
| 53 | if (state != ReadyForTransfer) { SWIFT_LOG(debug) << "Not ready for transfer!" << std::endl; return; } | 53 | if (state != ReadyForTransfer) { SWIFT_LOG(debug) << "Not ready for transfer!"; return; } |
| 54 | 54 | ||
| 55 | readBytestream = stream; | 55 | readBytestream = stream; |
| 56 | state = WritingData; | 56 | state = WritingData; |
| @@ -62,7 +62,7 @@ void SOCKS5BytestreamServerSession::startSending(std::shared_ptr<ReadBytestream> | |||
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | void SOCKS5BytestreamServerSession::startReceiving(std::shared_ptr<WriteBytestream> stream) { | 64 | void SOCKS5BytestreamServerSession::startReceiving(std::shared_ptr<WriteBytestream> stream) { |
| 65 | if (state != ReadyForTransfer) { SWIFT_LOG(debug) << "Not ready for transfer!" << std::endl; return; } | 65 | if (state != ReadyForTransfer) { SWIFT_LOG(debug) << "Not ready for transfer!"; return; } |
| 66 | 66 | ||
| 67 | writeBytestream = stream; | 67 | writeBytestream = stream; |
| 68 | state = ReadingData; | 68 | state = ReadingData; |
| @@ -93,7 +93,7 @@ void SOCKS5BytestreamServerSession::handleDataAvailable() { | |||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | void SOCKS5BytestreamServerSession::handleDisconnected(const boost::optional<Connection::Error>& error) { | 95 | void SOCKS5BytestreamServerSession::handleDisconnected(const boost::optional<Connection::Error>& error) { |
| 96 | SWIFT_LOG(debug) << (error ? (error == Connection::ReadError ? "Read Error" : "Write Error") : "No Error") << std::endl; | 96 | SWIFT_LOG(debug) << (error ? (error == Connection::ReadError ? "Read Error" : "Write Error") : "No Error"); |
| 97 | finish(error ? boost::optional<FileTransferError>(FileTransferError::PeerError) : boost::optional<FileTransferError>()); | 97 | finish(error ? boost::optional<FileTransferError>(FileTransferError::PeerError) : boost::optional<FileTransferError>()); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| @@ -109,7 +109,7 @@ void SOCKS5BytestreamServerSession::process() { | |||
| 109 | if (i == 2 + authCount) { | 109 | if (i == 2 + authCount) { |
| 110 | // Authentication message is complete | 110 | // Authentication message is complete |
| 111 | if (i != unprocessedData.size()) { | 111 | if (i != unprocessedData.size()) { |
| 112 | SWIFT_LOG(debug) << "Junk after authentication mechanism" << std::endl; | 112 | SWIFT_LOG(debug) << "Junk after authentication mechanism"; |
| 113 | } | 113 | } |
| 114 | unprocessedData.clear(); | 114 | unprocessedData.clear(); |
| 115 | connection->write(createSafeByteArray("\x05\x00", 2)); | 115 | connection->write(createSafeByteArray("\x05\x00", 2)); |
| @@ -130,7 +130,7 @@ void SOCKS5BytestreamServerSession::process() { | |||
| 130 | i += 2; | 130 | i += 2; |
| 131 | if (i <= unprocessedData.size()) { | 131 | if (i <= unprocessedData.size()) { |
| 132 | if (i != unprocessedData.size()) { | 132 | if (i != unprocessedData.size()) { |
| 133 | SWIFT_LOG(debug) << "Junk after authentication mechanism" << std::endl; | 133 | SWIFT_LOG(debug) << "Junk after authentication mechanism"; |
| 134 | } | 134 | } |
| 135 | unprocessedData.clear(); | 135 | unprocessedData.clear(); |
| 136 | streamID = byteArrayToString(requestID); | 136 | streamID = byteArrayToString(requestID); |
| @@ -142,18 +142,18 @@ void SOCKS5BytestreamServerSession::process() { | |||
| 142 | result.push_back(boost::numeric_cast<unsigned char>(requestID.size())); | 142 | result.push_back(boost::numeric_cast<unsigned char>(requestID.size())); |
| 143 | } | 143 | } |
| 144 | catch (const boost::numeric::bad_numeric_cast& e) { | 144 | catch (const boost::numeric::bad_numeric_cast& e) { |
| 145 | SWIFT_LOG(warning) << "SOCKS5 request ID is too long (" << requestID.size() << "): " << e.what() << std::endl; | 145 | SWIFT_LOG(warning) << "SOCKS5 request ID is too long (" << requestID.size() << "): " << e.what(); |
| 146 | finish(); | 146 | finish(); |
| 147 | return; | 147 | return; |
| 148 | } | 148 | } |
| 149 | append(result, concat(requestID, createByteArray("\x00\x00", 2))); | 149 | append(result, concat(requestID, createByteArray("\x00\x00", 2))); |
| 150 | if (!hasBytestream) { | 150 | if (!hasBytestream) { |
| 151 | SWIFT_LOG(debug) << "Readstream or Wrtiestream with ID " << streamID << " not found!" << std::endl; | 151 | SWIFT_LOG(debug) << "Readstream or Wrtiestream with ID " << streamID << " not found!"; |
| 152 | connection->write(result); | 152 | connection->write(result); |
| 153 | finish(boost::optional<FileTransferError>(FileTransferError::PeerError)); | 153 | finish(boost::optional<FileTransferError>(FileTransferError::PeerError)); |
| 154 | } | 154 | } |
| 155 | else { | 155 | else { |
| 156 | SWIFT_LOG(debug) << "Found stream. Sent OK." << std::endl; | 156 | SWIFT_LOG(debug) << "Found stream. Sent OK."; |
| 157 | connection->write(result); | 157 | connection->write(result); |
| 158 | state = ReadyForTransfer; | 158 | state = ReadyForTransfer; |
| 159 | } | 159 | } |
| @@ -185,7 +185,7 @@ void SOCKS5BytestreamServerSession::sendData() { | |||
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | void SOCKS5BytestreamServerSession::finish(const boost::optional<FileTransferError>& error) { | 187 | void SOCKS5BytestreamServerSession::finish(const boost::optional<FileTransferError>& error) { |
| 188 | SWIFT_LOG(debug) << "state: " << state << std::endl; | 188 | SWIFT_LOG(debug) << "state: " << state; |
| 189 | if (state == Finished) { | 189 | if (state == Finished) { |
| 190 | return; | 190 | return; |
| 191 | } | 191 | } |
Swift