1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 12:02:05 +01:00

Improve stanza ack listener handling

- Don't abort if there is a NotConnectedExceptions, other listeners may
  want to be informed of the ack nevertheless.
- Simply return if the id is null or empty.
This commit is contained in:
Florian Schmaus 2015-01-13 11:21:47 +01:00
parent 24b940138f
commit 2aaedcb2fd

View file

@ -1651,22 +1651,28 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
asyncGo(new Runnable() { asyncGo(new Runnable() {
@Override @Override
public void run() { public void run() {
try { for (Packet ackedStanza : ackedStanzas) {
for (Packet ackedStanza : ackedStanzas) { for (PacketListener listener : stanzaAcknowledgedListeners) {
for (PacketListener listener : stanzaAcknowledgedListeners) { try {
listener.processPacket(ackedStanza); listener.processPacket(ackedStanza);
} }
String id = ackedStanza.getPacketID(); catch (NotConnectedException e) {
if (id != null) { LOGGER.log(Level.FINER, "Received not connected exception", e);
PacketListener listener = stanzaIdAcknowledgedListeners.remove(id); }
if (listener != null) { }
listener.processPacket(ackedStanza); String id = ackedStanza.getPacketID();
} if (StringUtils.isNotEmpty(id)) {
return;
}
PacketListener listener = stanzaIdAcknowledgedListeners.remove(id);
if (listener != null) {
try {
listener.processPacket(ackedStanza);
}
catch (NotConnectedException e) {
LOGGER.log(Level.FINER, "Received not connected exception", e);
} }
} }
}
catch (NotConnectedException e) {
LOGGER.log(Level.FINER, "Received not connected exception, aborting", e);
} }
} }
}); });