catch state changing error when sending timeout to iq callbacks

This commit is contained in:
Daniel Gultsch 2017-07-03 19:44:01 +02:00
parent 7cf360fabf
commit 5cac4397dd

View File

@ -1086,7 +1086,12 @@ public class XmppConnection implements Runnable {
} }
} }
for(OnIqPacketReceived callback : callbacks) { for(OnIqPacketReceived callback : callbacks) {
callback.onIqPacketReceived(account,failurePacket); try {
callback.onIqPacketReceived(account, failurePacket);
} catch (StateChangingError error) {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": caught StateChangingError("+error.state.toString()+") while clearing callbacks");
//ignore
}
} }
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": done clearing iq callbacks. " + this.packetCallbacks.size() + " left"); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": done clearing iq callbacks. " + this.packetCallbacks.size() + " left");
} }
@ -1322,8 +1327,7 @@ public class XmppConnection implements Runnable {
public synchronized String sendUnmodifiedIqPacket(final IqPacket packet, final OnIqPacketReceived callback) { public synchronized String sendUnmodifiedIqPacket(final IqPacket packet, final OnIqPacketReceived callback) {
if (packet.getId() == null) { if (packet.getId() == null) {
final String id = nextRandomId(); packet.setAttribute("id", nextRandomId());
packet.setAttribute("id", id);
} }
if (callback != null) { if (callback != null) {
synchronized (this.packetCallbacks) { synchronized (this.packetCallbacks) {