moved actual iq callback out of synchronized find callback block
This commit is contained in:
parent
ea2ce78d6e
commit
f6b7a25e29
|
@ -472,29 +472,33 @@ public class XmppConnection implements Runnable {
|
||||||
this.jingleListener.onJinglePacketReceived(account,(JinglePacket) packet);
|
this.jingleListener.onJinglePacketReceived(account,(JinglePacket) packet);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
OnIqPacketReceived callback = null;
|
||||||
synchronized (this.packetCallbacks) {
|
synchronized (this.packetCallbacks) {
|
||||||
if (packetCallbacks.containsKey(packet.getId())) {
|
if (packetCallbacks.containsKey(packet.getId())) {
|
||||||
final Pair<IqPacket, OnIqPacketReceived> packetCallbackDuple = packetCallbacks.get(packet.getId());
|
final Pair<IqPacket, OnIqPacketReceived> packetCallbackDuple = packetCallbacks.get(packet.getId());
|
||||||
// Packets to the server should have responses from the server
|
// Packets to the server should have responses from the server
|
||||||
if (packetCallbackDuple.first.toServer(account)) {
|
if (packetCallbackDuple.first.toServer(account)) {
|
||||||
if (packet.fromServer(account)) {
|
if (packet.fromServer(account)) {
|
||||||
packetCallbackDuple.second.onIqPacketReceived(account, packet);
|
callback = packetCallbackDuple.second;
|
||||||
packetCallbacks.remove(packet.getId());
|
packetCallbacks.remove(packet.getId());
|
||||||
} else {
|
} else {
|
||||||
Log.e(Config.LOGTAG, account.getJid().toBareJid().toString() + ": ignoring spoofed iq packet");
|
Log.e(Config.LOGTAG, account.getJid().toBareJid().toString() + ": ignoring spoofed iq packet");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (packet.getFrom().equals(packetCallbackDuple.first.getTo())) {
|
if (packet.getFrom().equals(packetCallbackDuple.first.getTo())) {
|
||||||
packetCallbackDuple.second.onIqPacketReceived(account, packet);
|
callback = packetCallbackDuple.second;
|
||||||
packetCallbacks.remove(packet.getId());
|
packetCallbacks.remove(packet.getId());
|
||||||
} else {
|
} else {
|
||||||
Log.e(Config.LOGTAG, account.getJid().toBareJid().toString() + ": ignoring spoofed iq packet");
|
Log.e(Config.LOGTAG, account.getJid().toBareJid().toString() + ": ignoring spoofed iq packet");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (packet.getType() == IqPacket.TYPE.GET || packet.getType() == IqPacket.TYPE.SET) {
|
} 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue