diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-09-03 19:50:42 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-09-03 19:50:42 +0200 |
commit | 71e4bcf9cb807e2f3954a5e968a44a409aaeebd7 (patch) | |
tree | e1f92e73467a3c5cad8da7943fbc8dbf0eb1f6be /src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java | |
parent | edcfdb974dc544c0e79e457f50c12e5942619251 (diff) |
bare minimum direct connections
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java index 7050874fb..00acb6ca3 100644 --- a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java @@ -308,9 +308,13 @@ public class JingleConnection implements Transferable { this.transportId = this.mJingleConnectionManager.nextRandomId(); if (this.initialTransport == Transport.IBB) { this.sendInitRequest(); - } else if (this.candidates.size() > 0) { - this.sendInitRequest(); //TODO we will never get here? Can probably be removed } else { + final List<JingleCandidate> directCandidates = DirectConnectionUtils.getLocalCandidates(account.getJid()); + for (JingleCandidate directCandidate : directCandidates) { + final JingleSocks5Transport socksConnection = new JingleSocks5Transport(this, directCandidate); + connections.put(directCandidate.getCid(), socksConnection); + candidates.add(directCandidate); + } this.mJingleConnectionManager.getPrimaryCandidate(account, (success, candidate) -> { if (success) { final JingleSocks5Transport socksConnection = new JingleSocks5Transport(this, candidate); @@ -699,7 +703,7 @@ public class JingleConnection implements Transferable { onProxyActivated.failed(); return true; } else if (content.socks5transport().hasChild("candidate-error")) { - Log.d(Config.LOGTAG, "received candidate error"); + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received candidate error"); this.receivedCandidate = true; if (mJingleStatus == JINGLE_STATUS_ACCEPTED && this.sentCandidate) { this.connect(); @@ -737,7 +741,7 @@ public class JingleConnection implements Transferable { final JingleSocks5Transport connection = chooseConnection(); this.transport = connection; if (connection == null) { - Log.d(Config.LOGTAG, "could not find suitable candidate"); + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": could not find suitable candidate"); this.disconnectSocks5Connections(); if (initiating()) { this.sendFallbackToIbb(); @@ -764,6 +768,7 @@ public class JingleConnection implements Transferable { .setContent(this.getCounterPart().toString()); mXmppConnectionService.sendIqPacket(account, activation, (account, response) -> { if (response.getType() != IqPacket.TYPE.RESULT) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": " + response.toString()); onProxyActivated.failed(); } else { onProxyActivated.success(); @@ -1061,7 +1066,7 @@ public class JingleConnection implements Transferable { } private void sendCandidateError() { - Log.d(Config.LOGTAG, "sending candidate error"); + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": sending candidate error"); JinglePacket packet = bootstrapPacket("transport-info"); Content content = new Content(this.contentCreator, this.contentName); content.setTransportId(this.transportId); |