1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-22 02:27:58 +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() {
@Override
public void run() {
try {
for (Packet ackedStanza : ackedStanzas) {
for (PacketListener listener : stanzaAcknowledgedListeners) {
for (Packet ackedStanza : ackedStanzas) {
for (PacketListener listener : stanzaAcknowledgedListeners) {
try {
listener.processPacket(ackedStanza);
}
String id = ackedStanza.getPacketID();
if (id != null) {
PacketListener listener = stanzaIdAcknowledgedListeners.remove(id);
if (listener != null) {
listener.processPacket(ackedStanza);
}
catch (NotConnectedException e) {
LOGGER.log(Level.FINER, "Received not connected exception", e);
}
}
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);
}
}
});