diff options
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 c41c5174..decfabf6 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"); |