diff options
author | Tobias Markmann <tm@ayena.de> | 2016-06-29 15:06:30 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-06-29 15:11:43 (GMT) |
commit | 82dd5a11131b3bd3641316b87aa279d806c970b0 (patch) | |
tree | 659ac3d0e1520a1fbe1265500e0b73c8597a00a8 /Swiften/FileTransfer/DefaultFileTransferTransporter.cpp | |
parent | 09c22ea2ff3ff40b9b298475d47809b4bd373216 (diff) | |
download | swift-82dd5a11131b3bd3641316b87aa279d806c970b0.zip swift-82dd5a11131b3bd3641316b87aa279d806c970b0.tar.bz2 |
Fail file-transfer if proxy session of candidate does not exist
Test-Information:
Tested with a buggy XMPP client that calculates S5B DSTADDR
in a non-standard way. Previously this lead to Swift crashing
on an assert. Now Swift just indicates file-transfer failure
to the other party.
Change-Id: I4ed47f9647a1851f2a5101657bcd569c106d638f
Diffstat (limited to 'Swiften/FileTransfer/DefaultFileTransferTransporter.cpp')
-rw-r--r-- | Swiften/FileTransfer/DefaultFileTransferTransporter.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp index 9428d0b..aefafd9 100644 --- a/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp +++ b/Swiften/FileTransfer/DefaultFileTransferTransporter.cpp @@ -204,8 +204,12 @@ std::shared_ptr<TransportSession> DefaultFileTransferTransporter::createLocalCan std::shared_ptr<TransportSession> transportSession; if (candidate.type == JingleS5BTransportPayload::Candidate::ProxyType) { SOCKS5BytestreamClientSession::ref proxySession = s5bProxy->getProxySessionAndCloseOthers(candidate.jid, getLocalCandidateSOCKS5DstAddr()); - assert(proxySession); - transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream); + if (proxySession) { + transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream); + } + else { + SWIFT_LOG(error) << "Failed obtaining proxy session with candidate JID " << candidate.jid << " and dstAddr " << getLocalCandidateSOCKS5DstAddr() << "." << std::endl; + } } if (!transportSession) { @@ -227,8 +231,12 @@ std::shared_ptr<TransportSession> DefaultFileTransferTransporter::createLocalCan std::shared_ptr<TransportSession> transportSession; if (candidate.type == JingleS5BTransportPayload::Candidate::ProxyType) { SOCKS5BytestreamClientSession::ref proxySession = s5bProxy->getProxySessionAndCloseOthers(candidate.jid, getLocalCandidateSOCKS5DstAddr()); - assert(proxySession); - transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream); + if (proxySession) { + transportSession = std::make_shared<S5BTransportSession<SOCKS5BytestreamClientSession> >(proxySession, stream); + } + else { + SWIFT_LOG(error) << "Failed obtaining proxy session with candidate JID " << candidate.jid << " and dstAddr " << getLocalCandidateSOCKS5DstAddr() << "." << std::endl; + } } if (!transportSession) { |