1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 15:52:06 +01:00

sendStanzaWithResponseCallback(): remove listener right away

I'm not sure why i've put the removeAsyncStanzaListener() call into
the finally block. If callback.processStanza(Stanza) takes a long
time (or even blocks), then it would appear to the "no response"
handling Runnable as if there was no response, when in fact there was
one.
This commit is contained in:
Florian Schmaus 2017-01-30 16:57:43 +01:00
parent 187fe37cd7
commit b142060f9e

View file

@ -1494,6 +1494,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
final StanzaListener packetListener = new StanzaListener() {
@Override
public void processStanza(Stanza packet) throws NotConnectedException, InterruptedException {
removeAsyncStanzaListener(this);
try {
XMPPErrorException.ifHasErrorThenThrow(packet);
callback.processStanza(packet);
@ -1503,9 +1504,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
exceptionCallback.processException(e);
}
}
finally {
removeAsyncStanzaListener(this);
}
}
};
removeCallbacksService.schedule(new Runnable() {