diff options
author | Tobias Markmann <tm@ayena.de> | 2015-01-11 17:13:41 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2015-02-11 09:36:14 (GMT) |
commit | a049c80f0862a994a76e8e63d71c633bce63f66a (patch) | |
tree | c5fc7786d2d245c765067545bb9a0e433e58a3f9 /Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp | |
parent | f176050a50fb846bbad3fb49d6b2f7a2c81e3589 (diff) | |
download | swift-a049c80f0862a994a76e8e63d71c633bce63f66a.zip swift-a049c80f0862a994a76e8e63d71c633bce63f66a.tar.bz2 |
Renable SOCKS5 bytestream proxy support for Jingle file transfers.
Test-Information:
Tested interoperability with Swiften using FileTransferTest.
Change-Id: Ic13a68a91cad199be0bfc8852ff43c25c7085f12
Diffstat (limited to 'Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp')
-rw-r--r-- | Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp index 82fd17e..812adbe 100644 --- a/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp +++ b/Swiften/FileTransfer/SOCKS5BytestreamClientSession.cpp @@ -2,13 +2,13 @@ * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* - * Copyright (c) 2013 Isode Limited. + * Copyright (c) 2013-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include "SOCKS5BytestreamClientSession.h" @@ -33,13 +33,13 @@ SOCKS5BytestreamClientSession::SOCKS5BytestreamClientSession( TimerFactory* timerFactory) : connection(connection), addressPort(addressPort), destination(destination), state(Initial), chunkSize(131072) { - weFailedTimeout = timerFactory->createTimer(2000); + weFailedTimeout = timerFactory->createTimer(3000); weFailedTimeout->onTick.connect( boost::bind(&SOCKS5BytestreamClientSession::handleWeFailedTimeout, this)); } SOCKS5BytestreamClientSession::~SOCKS5BytestreamClientSession() { } @@ -52,12 +52,15 @@ void SOCKS5BytestreamClientSession::start() { boost::bind(&SOCKS5BytestreamClientSession::handleConnectFinished, this, _1)); connection->connect(addressPort); } void SOCKS5BytestreamClientSession::stop() { SWIFT_LOG(debug) << std::endl; + if (state < Ready) { + weFailedTimeout->stop(); + } if (state == Finished) { return; } closeConnection(); readBytestream.reset(); state = Finished; @@ -198,13 +201,15 @@ void SOCKS5BytestreamClientSession::sendData() { finish(false); } } void SOCKS5BytestreamClientSession::finish(bool error) { SWIFT_LOG(debug) << std::endl; - weFailedTimeout->stop(); + if (state < Ready) { + weFailedTimeout->stop(); + } closeConnection(); readBytestream.reset(); if (state == Initial || state == Hello || state == Authenticating) { onSessionReady(true); } else { @@ -225,12 +230,13 @@ void SOCKS5BytestreamClientSession::handleConnectFinished(bool error) { } else { SWIFT_LOG(debug) << "Successfully connected via TCP" << addressPort.toString() << "." << std::endl; disconnectedConnection = connection->onDisconnected.connect( boost::bind(&SOCKS5BytestreamClientSession::handleDisconnected, this, _1)); dataReadConnection = connection->onDataRead.connect( boost::bind(&SOCKS5BytestreamClientSession::handleDataRead, this, _1)); + weFailedTimeout->stop(); weFailedTimeout->start(); process(); } } void SOCKS5BytestreamClientSession::handleDataRead(boost::shared_ptr<SafeByteArray> data) { |