diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-08-06 14:54:37 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-08-06 14:54:37 +0200 |
commit | 6694af8fcadbfdbb2d83e5fffda558478f595e63 (patch) | |
tree | d5b971aac562a8c2dfe3bf94939a9ae3c4e3352d /src/main/java | |
parent | 5c0853f30250214b15d7cceb9a0dc34a6c99b7e5 (diff) |
fail old/invalid iq stanzas on bind
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index c41c5174e..decfabf67 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -34,6 +34,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Hashtable; +import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -709,6 +710,7 @@ public class XmppConnection implements Runnable { } catch (final InterruptedException ignored) { } } + clearIqCallbacks(); final IqPacket iq = new IqPacket(IqPacket.TYPE.SET); iq.addChild("bind", "urn:ietf:params:xml:ns:xmpp-bind") .addChild("resource").setContent(account.getResource()); @@ -739,6 +741,17 @@ public class XmppConnection implements Runnable { }); } + private void clearIqCallbacks() { + Log.d(Config.LOGTAG,account.getJid().toBareJid()+": clearing iq iq callbacks"); + final IqPacket failurePacket = new IqPacket(IqPacket.TYPE.ERROR); + Iterator<Entry<String, Pair<IqPacket, OnIqPacketReceived>>> iterator = this.packetCallbacks.entrySet().iterator(); + while(iterator.hasNext()) { + Entry<String, Pair<IqPacket, OnIqPacketReceived>> entry = iterator.next(); + entry.getValue().second.onIqPacketReceived(account,failurePacket); + iterator.remove(); + } + } + private void sendStartSession() { final IqPacket startSession = new IqPacket(IqPacket.TYPE.SET); startSession.addChild("session","urn:ietf:params:xml:ns:xmpp-session"); |