1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-20 17:47:57 +01:00

SMACK-395 Socks5BytestreamManager.establishConnection(): Don't bail out with an Exception uf the local XMPP service does not support Service Discovery (e.g. talk.google.com). Instead remember the Exception and give the local proxy (if enabled) a chance.

Also compute the digest only if it's really needed, that is when streamHosts is not empty.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13440 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2013-02-04 21:36:39 +00:00 committed by flow
parent 55893400c7
commit 592135c0e9

View file

@ -414,24 +414,32 @@ public final class Socks5BytestreamManager implements BytestreamManager {
public Socks5BytestreamSession establishSession(String targetJID, String sessionID)
throws XMPPException, IOException, InterruptedException {
XMPPException discoveryException = null;
// check if target supports SOCKS5 Bytestream
if (!supportsSocks5(targetJID)) {
throw new XMPPException(targetJID + " doesn't support SOCKS5 Bytestream");
}
List<String> proxies = new ArrayList<String>();
// determine SOCKS5 proxies from XMPP-server
List<String> proxies = determineProxies();
try {
determineProxies();
} catch (XMPPException e) {
// don't abort here, just remember the exception thrown by determineProxies()
// determineStreamHostInfos() will at least add the local Socks5 proxy (if enabled)
discoveryException = e;
}
// determine address and port of each proxy
List<StreamHost> streamHosts = determineStreamHostInfos(proxies);
if (streamHosts.isEmpty()) {
throw discoveryException != null ? discoveryException : new XMPPException("no SOCKS5 proxies available");
}
// compute digest
String digest = Socks5Utils.createDigest(sessionID, this.connection.getUser(), targetJID);
if (streamHosts.isEmpty()) {
throw new XMPPException("no SOCKS5 proxies available");
}
// prioritize last working SOCKS5 proxy if exists
if (this.proxyPrioritizationEnabled && this.lastWorkingProxy != null) {
StreamHost selectedStreamHost = null;