1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-21 22:02:06 +01:00

Delay notifyConnectionError in writer shutdown

This commit is contained in:
Florian Schmaus 2016-06-06 11:32:38 +02:00
parent 8deac592fb
commit 08c93da56a

View file

@ -1349,6 +1349,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
}
private void writePackets() {
Exception writerException = null;
try {
openStream();
initalOpenStreamSend.reportSuccess();
@ -1471,7 +1472,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
// The exception can be ignored if the the connection is 'done'
// or if the it was caused because the socket got closed
if (!(done() || queue.isShutdown())) {
notifyConnectionError(e);
writerException = e;
} else {
LOGGER.log(Level.FINE, "Ignoring Exception in writePackets()", e);
}
@ -1479,6 +1480,10 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
LOGGER.fine("Reporting shutdownDone success in writer thread");
shutdownDone.reportSuccess();
}
// Delay notifyConnectionError after shutdownDone has been reported in the finally block.
if (writerException != null) {
notifyConnectionError(writerException);
}
}
private void drainWriterQueueToUnacknowledgedStanzas() {