mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22: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:
parent
24b940138f
commit
2aaedcb2fd
1 changed files with 18 additions and 12 deletions
|
@ -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();
|
|
||||||
if (id != null) {
|
|
||||||
PacketListener listener = stanzaIdAcknowledgedListeners.remove(id);
|
|
||||||
if (listener != null) {
|
|
||||||
listener.processPacket(ackedStanza);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (NotConnectedException e) {
|
catch (NotConnectedException e) {
|
||||||
LOGGER.log(Level.FINER, "Received not connected exception, aborting", 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue