mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
sendStanzaWithResponseCallback: Ensure exactly one callback is called
This commit is contained in:
parent
46e8866440
commit
872b254db5
1 changed files with 6 additions and 1 deletions
|
@ -1494,7 +1494,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
final StanzaListener packetListener = new StanzaListener() {
|
||||
@Override
|
||||
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
|
||||
removeAsyncStanzaListener(this);
|
||||
boolean removed = removeAsyncStanzaListener(this);
|
||||
if (!removed) {
|
||||
// We lost a race against the "no response" handling runnable. Avoid calling the callback, as the
|
||||
// exception callback will be invoked (if any).
|
||||
return;
|
||||
}
|
||||
try {
|
||||
XMPPErrorException.ifHasErrorThenThrow(packet);
|
||||
callback.processStanza(packet);
|
||||
|
|
Loading…
Reference in a new issue