diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-11-14 20:48:47 +0100 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-11-15 17:14:09 +0100 |
commit | b73774260ab692f0c801ec09ec7f7e1d397a820e (patch) | |
tree | 3a5be2f90f4ab0c436b15d23f1db4a6913a6bba4 /src/main/java/de/pixart/messenger | |
parent | 528649cd70d7db6abe99351d2b15b6de5b612e03 (diff) |
make jingle state transitions less error prone
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java | 30 |
1 files changed, 28 insertions, 2 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 9adb6f62e..9ac39ed5c 100644 --- a/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/jingle/JingleConnection.java @@ -73,6 +73,8 @@ public class JingleConnection implements Transferable { private Element fileOffer; private DownloadableFile file = null; + private boolean proxyActivationFailed = false; + private String contentName; private String contentCreator; private Transport initialTransport; @@ -177,6 +179,7 @@ public class JingleConnection implements Transferable { @Override public void failed() { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": proxy activation failed"); + proxyActivationFailed = true; if (initiating()) { sendFallbackToIbb(); } @@ -718,6 +721,11 @@ public class JingleConnection implements Transferable { } private void receiveAccept(JinglePacket packet) { + if (responding()) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received out of order session-accept (we were responding)"); + respondToIqWithOutOfOrder(packet); + return; + } if (this.mJingleStatus != JINGLE_STATUS_INITIATED) { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received out of order session-accept"); respondToIqWithOutOfOrder(packet); @@ -927,6 +935,16 @@ public class JingleConnection implements Transferable { private void receiveFallbackToIbb(JinglePacket packet) { + if (initiating()) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received out of order transport-replace (we were initiating)"); + respondToIqWithOutOfOrder(packet); + return; + } + if (mJingleStatus != JINGLE_STATUS_ACCEPTED && !proxyActivationFailed) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received out of order transport-replace"); + respondToIqWithOutOfOrder(packet); + return; + } Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": receiving fallback to ibb"); final String receivedBlockSize = packet.getJingleContent().ibbTransport().getAttribute("block-size"); if (receivedBlockSize != null) { @@ -965,6 +983,16 @@ public class JingleConnection implements Transferable { } private void receiveTransportAccept(JinglePacket packet) { + if (responding()) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received out of order transport-accept (we were responding)"); + respondToIqWithOutOfOrder(packet); + return; + } + if (this.mJingleStatus != JINGLE_STATUS_ACCEPTED) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received out of order transport-accept"); + respondToIqWithOutOfOrder(packet); + return; + } if (packet.getJingleContent().hasIbbTransport()) { final Element ibbTransport = packet.getJingleContent().ibbTransport(); final String receivedBlockSize = ibbTransport.getAttribute("block-size"); @@ -988,8 +1016,6 @@ public class JingleConnection implements Transferable { //might be receive instead if we are not initiating if (initiating()) { this.transport.connect(onIbbTransportConnected); - } else { - this.transport.receive(file, onFileTransmissionStatusChanged); } } else { Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received invalid transport-accept"); |