correctly calculate socks destination

This commit is contained in:
Daniel Gultsch 2021-10-02 16:44:36 +02:00
parent da14f83a42
commit d2a387e82f
1 changed files with 7 additions and 16 deletions

View File

@ -60,7 +60,6 @@ public class JingleSocks5Transport extends JingleTransport {
} else { } else {
destBuilder.append(this.connection.getTransportId()); destBuilder.append(this.connection.getTransportId());
} }
if (candidate.getType() == JingleCandidate.TYPE_PROXY) {
if (candidate.isOurs()) { if (candidate.isOurs()) {
destBuilder.append(this.account.getJid()); destBuilder.append(this.account.getJid());
destBuilder.append(this.connection.getId().with); destBuilder.append(this.connection.getId().with);
@ -68,15 +67,6 @@ public class JingleSocks5Transport extends JingleTransport {
destBuilder.append(this.connection.getId().with); destBuilder.append(this.connection.getId().with);
destBuilder.append(this.account.getJid()); destBuilder.append(this.account.getJid());
} }
} else {
if (connection.isInitiator()) {
destBuilder.append(this.account.getJid());
destBuilder.append(this.connection.getId().with);
} else {
destBuilder.append(this.connection.getId().with);
destBuilder.append(this.account.getJid());
}
}
messageDigest.reset(); messageDigest.reset();
this.destination = CryptoHelper.bytesToHex(messageDigest.digest(destBuilder.toString().getBytes())); this.destination = CryptoHelper.bytesToHex(messageDigest.digest(destBuilder.toString().getBytes()));
if (candidate.isOurs() && candidate.getType() == JingleCandidate.TYPE_DIRECT) { if (candidate.isOurs() && candidate.getType() == JingleCandidate.TYPE_DIRECT) {
@ -189,7 +179,8 @@ public class JingleSocks5Transport extends JingleTransport {
socket.setSoTimeout(0); socket.setSoTimeout(0);
isEstablished = true; isEstablished = true;
callback.established(); callback.established();
} catch (IOException e) { } catch (final IOException e) {
Log.d(Config.LOGTAG, "unable to establish connection to candidate", e);
callback.failed(); callback.failed();
} }
}).start(); }).start();