diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-08-26 14:01:37 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-08-26 14:01:37 +0200 |
commit | f6b7a25e290d3ddfa46a5e704b05abe0e6b50dd5 (patch) | |
tree | 7af5ba63b551cef9b48023db6745bc1508599c9d | |
parent | ea2ce78d6e0b37db21ebffd9f0f991ab25e17f1a (diff) |
moved actual iq callback out of synchronized find callback block
-rw-r--r-- | src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 6a94a5f3..bb0c3987 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -472,29 +472,33 @@ public class XmppConnection implements Runnable { this.jingleListener.onJinglePacketReceived(account,(JinglePacket) packet); } } else { + OnIqPacketReceived callback = null; synchronized (this.packetCallbacks) { if (packetCallbacks.containsKey(packet.getId())) { final Pair<IqPacket, OnIqPacketReceived> packetCallbackDuple = packetCallbacks.get(packet.getId()); // Packets to the server should have responses from the server if (packetCallbackDuple.first.toServer(account)) { if (packet.fromServer(account)) { - packetCallbackDuple.second.onIqPacketReceived(account, packet); + callback = packetCallbackDuple.second; packetCallbacks.remove(packet.getId()); } else { Log.e(Config.LOGTAG, account.getJid().toBareJid().toString() + ": ignoring spoofed iq packet"); } } else { if (packet.getFrom().equals(packetCallbackDuple.first.getTo())) { - packetCallbackDuple.second.onIqPacketReceived(account, packet); + callback = packetCallbackDuple.second; packetCallbacks.remove(packet.getId()); } else { Log.e(Config.LOGTAG, account.getJid().toBareJid().toString() + ": ignoring spoofed iq packet"); } } } else if (packet.getType() == IqPacket.TYPE.GET || packet.getType() == IqPacket.TYPE.SET) { - this.unregisteredIqListener.onIqPacketReceived(account, packet); + callback = this.unregisteredIqListener; } } + if (callback != null) { + callback.onIqPacketReceived(account,packet); + } } } |