diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 25f210b12..9097a1256 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -1232,6 +1232,12 @@ public class XmppConnection implements Runnable { + "'"); return; } + if (Thread.currentThread().isInterrupted()) { + Log.d( + Config.LOGTAG, + account.getJid().asBareJid() + "Not processing iq. Thread was interrupted"); + return; + } if (packet instanceof JinglePacket jinglePacket && isBound) { if (this.jingleListener != null) { this.jingleListener.onJinglePacketReceived(account, jinglePacket); @@ -1308,11 +1314,18 @@ public class XmppConnection implements Runnable { + "'"); return; } + if (Thread.currentThread().isInterrupted()) { + Log.d( + Config.LOGTAG, + account.getJid().asBareJid() + + "Not processing message. Thread was interrupted"); + return; + } this.messageListener.onMessagePacketReceived(account, packet); } private void processPresence(final Tag currentTag) throws IOException { - PresencePacket packet = (PresencePacket) processPacket(currentTag, PACKET_PRESENCE); + final PresencePacket packet = (PresencePacket) processPacket(currentTag, PACKET_PRESENCE); if (!packet.valid()) { Log.e( Config.LOGTAG, @@ -1323,6 +1336,13 @@ public class XmppConnection implements Runnable { + "'"); return; } + if (Thread.currentThread().isInterrupted()) { + Log.d( + Config.LOGTAG, + account.getJid().asBareJid() + + "Not processing presence. Thread was interrupted"); + return; + } this.presenceListener.onPresencePacketReceived(account, packet); }