diff options
author | Tobias Markmann <tm@ayena.de> | 2015-03-08 16:10:30 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2015-05-01 17:35:37 (GMT) |
commit | f9dcd7a6e81e6c244e111aa1a22992f0604d999c (patch) | |
tree | bbea79fd81acce49ac163ffdd03224f096e49057 /Swiften | |
parent | 794fec2873e69ec047974416768b32b69754dad1 (diff) | |
download | swift-f9dcd7a6e81e6c244e111aa1a22992f0604d999c.zip swift-f9dcd7a6e81e6c244e111aa1a22992f0604d999c.tar.bz2 |
Only close unneedded S5B connections on the S5B server if a S5B server is running
Add a check on whether we have a running SOCKS5 bytestream server
before trying to access it to close unneeded S5B connections to it
after we decided on a candidate to use.
Test-Information:
Without this FileTransferTest crashes in the configuration that does
not allow direct or assisted S5B connections. This patch fixes this
issue.
Change-Id: Ifcf59f82755b9620e7f5fa5841e45815a41ac442
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/FileTransfer/DefaultFileTransferTransporter.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp index 568fa7c..dffc39b 100644 --- a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp +++ b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp @@ -145,7 +145,9 @@ void DefaultFileTransferTransporter::stopActivatingProxy() { boost::shared_ptr<TransportSession> DefaultFileTransferTransporter::createIBBSendSession( const std::string& sessionID, unsigned int blockSize, boost::shared_ptr<ReadBytestream> stream) { - closeLocalSession(); + if (s5bServerManager->getServer()) { + closeLocalSession(); + } closeRemoteSession(); boost::shared_ptr<IBBSendSession> ibbSession = boost::make_shared<IBBSendSession>( sessionID, initiator, responder, stream, router); @@ -157,8 +159,8 @@ boost::shared_ptr<TransportSession> DefaultFileTransferTransporter::createIBBRec const std::string& sessionID, unsigned long long size, boost::shared_ptr<WriteBytestream> stream) { if (s5bServerManager->getServer()) { closeLocalSession(); - closeRemoteSession(); } + closeRemoteSession(); boost::shared_ptr<IBBReceiveSession> ibbSession = boost::make_shared<IBBReceiveSession>( sessionID, initiator, responder, size, stream, router); return boost::make_shared<IBBReceiveTransportSession>(ibbSession); @@ -277,10 +279,11 @@ std::string DefaultFileTransferTransporter::getLocalCandidateSOCKS5DstAddr() con void DefaultFileTransferTransporter::closeLocalSession() { s5bRegistry->setHasBytestream(getSOCKS5DstAddr(), false); - std::vector<boost::shared_ptr<SOCKS5BytestreamServerSession> > serverSessions = - s5bServerManager->getServer()->getSessions(getSOCKS5DstAddr()); - foreach(boost::shared_ptr<SOCKS5BytestreamServerSession> session, serverSessions) { - session->stop(); + if (s5bServerManager->getServer()) { + std::vector<boost::shared_ptr<SOCKS5BytestreamServerSession> > serverSessions = s5bServerManager->getServer()->getSessions(getSOCKS5DstAddr()); + foreach(boost::shared_ptr<SOCKS5BytestreamServerSession> session, serverSessions) { + session->stop(); + } } } |