diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-09-03 19:57:29 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-09-03 19:57:29 +0200 |
commit | 9cd6fa50972da7e012185e4ede49bc52609a2e81 (patch) | |
tree | 48441537590d155ef033f4b53ef3335f53a59777 /src/main/java/de/pixart/messenger/xmpp | |
parent | f36ff9640d365cbab7838250ce00ce04de1b9d11 (diff) |
send fallback to ibb after proxy activation failed
Diffstat (limited to 'src/main/java/de/pixart/messenger/xmpp')
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java | 23 |
1 files changed, 17 insertions, 6 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 baae498e3..33b7c6e46 100644 --- a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java @@ -178,7 +178,9 @@ public class JingleConnection implements Transferable { @Override public void failed() { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": proxy activation failed"); - //TODO: when initiating send fallback to ibb + if (initiating()) { + sendFallbackToIbb(); + } } }; @@ -783,11 +785,11 @@ public class JingleConnection implements Transferable { mXmppConnectionService.sendIqPacket(account, activation, (account, response) -> { if (response.getType() != IqPacket.TYPE.RESULT) { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": " + response.toString()); + sendProxyError(); onProxyActivated.failed(); - //TODO send proxy-error } else { - onProxyActivated.success(); sendProxyActivated(connection.getCandidate().getCid()); + onProxyActivated.success(); } }); } else { @@ -871,7 +873,7 @@ public class JingleConnection implements Transferable { private boolean receiveFallbackToIbb(JinglePacket packet) { - Log.d(Config.LOGTAG, "receiving fallback to ibb"); + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": receiving fallback to ibb"); final String receivedBlockSize = packet.getJingleContent().ibbTransport().getAttribute("block-size"); if (receivedBlockSize != null) { try { @@ -1059,14 +1061,23 @@ public class JingleConnection implements Transferable { } private void sendProxyActivated(String cid) { - JinglePacket packet = bootstrapPacket("transport-info"); - Content content = new Content(this.contentCreator, this.contentName); + final JinglePacket packet = bootstrapPacket("transport-info"); + final Content content = new Content(this.contentCreator, this.contentName); content.setTransportId(this.transportId); content.socks5transport().addChild("activated").setAttribute("cid", cid); packet.setContent(content); this.sendJinglePacket(packet); } + private void sendProxyError() { + final JinglePacket packet = bootstrapPacket("transport-info"); + final Content content = new Content(this.contentCreator, this.contentName); + content.setTransportId(this.transportId); + content.socks5transport().addChild("proxy-error"); + packet.setContent(content); + this.sendJinglePacket(packet); + } + private void sendCandidateUsed(final String cid) { JinglePacket packet = bootstrapPacket("transport-info"); Content content = new Content(this.contentCreator, this.contentName); |