summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2014-08-21 08:38:11 (GMT)
committerKevin Smith <git@kismith.co.uk>2014-08-21 08:40:10 (GMT)
commit381b22fc365c27b9cd585f4b78f53ebc698d9f54 (patch)
tree0ffd89a8be13293c75c7ddfea524c74e0bf87b72 /Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
parent8ec22a9c5591584fd1725ed028d714c51b7509d3 (diff)
downloadswift-contrib-381b22fc365c27b9cd585f4b78f53ebc698d9f54.zip
swift-contrib-381b22fc365c27b9cd585f4b78f53ebc698d9f54.tar.bz2
Clean up compilation errors in Swiften due to boost 1.56
Can no longer implicitly convert boost::optional to bool temporaries. Also fixed assorted uses of cerr where logging was appropriate. Test-Information: Swiften compiles against boost 1.56 (link fails for me so far) Change-Id: Iec058af933a82a987da64291435a475f8b40ef96
Diffstat (limited to 'Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp')
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
index f393c8d..cb34c58 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerSession.cpp
@@ -62,71 +62,71 @@ void SOCKS5BytestreamServerSession::startSending(boost::shared_ptr<ReadBytestrea
sendData();
}
void SOCKS5BytestreamServerSession::startReceiving(boost::shared_ptr<WriteBytestream> stream) {
if (state != ReadyForTransfer) { SWIFT_LOG(debug) << "Not ready for transfer!" << std::endl; return; }
writeBytestream = stream;
state = ReadingData;
writeBytestream->write(unprocessedData);
// onBytesReceived(unprocessedData.size());
unprocessedData.clear();
}
HostAddressPort SOCKS5BytestreamServerSession::getAddressPort() const {
return connection->getLocalAddress();
}
void SOCKS5BytestreamServerSession::handleDataRead(boost::shared_ptr<SafeByteArray> data) {
if (state != ReadingData) {
append(unprocessedData, *data);
process();
} else {
writeBytestream->write(createByteArray(vecptr(*data), data->size()));
// onBytesReceived(data->size());
}
}
void SOCKS5BytestreamServerSession::handleDataAvailable() {
if (waitingForData) {
sendData();
}
}
void SOCKS5BytestreamServerSession::handleDisconnected(const boost::optional<Connection::Error>& error) {
SWIFT_LOG(debug) << (error ? (error == Connection::ReadError ? "Read Error" : "Write Error") : "No Error") << std::endl;
- finish(error);
+ finish(error ? true : false);
}
void SOCKS5BytestreamServerSession::process() {
if (state == WaitingForAuthentication) {
if (unprocessedData.size() >= 2) {
size_t authCount = unprocessedData[1];
size_t i = 2;
while (i < 2 + authCount && i < unprocessedData.size()) {
// Skip authentication mechanism
++i;
}
if (i == 2 + authCount) {
// Authentication message is complete
if (i != unprocessedData.size()) {
SWIFT_LOG(debug) << "Junk after authentication mechanism" << std::endl;
}
unprocessedData.clear();
connection->write(createSafeByteArray("\x05\x00", 2));
state = WaitingForRequest;
}
}
}
else if (state == WaitingForRequest) {
if (unprocessedData.size() >= 5) {
ByteArray requestID;
size_t i = 5;
size_t hostnameSize = unprocessedData[4];
while (i < 5 + hostnameSize && i < unprocessedData.size()) {
requestID.push_back(unprocessedData[i]);
++i;
}
// Skip the port: 2 byte large, one already skipped. Add one for comparison with size
i += 2;
if (i <= unprocessedData.size()) {
if (i != unprocessedData.size()) {