1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 13:32:07 +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() { private void writePackets() {
Exception writerException = null;
try { try {
openStream(); openStream();
initalOpenStreamSend.reportSuccess(); initalOpenStreamSend.reportSuccess();
@ -1471,7 +1472,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
// The exception can be ignored if the the connection is 'done' // The exception can be ignored if the the connection is 'done'
// or if the it was caused because the socket got closed // or if the it was caused because the socket got closed
if (!(done() || queue.isShutdown())) { if (!(done() || queue.isShutdown())) {
notifyConnectionError(e); writerException = e;
} else { } else {
LOGGER.log(Level.FINE, "Ignoring Exception in writePackets()", e); 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"); LOGGER.fine("Reporting shutdownDone success in writer thread");
shutdownDone.reportSuccess(); shutdownDone.reportSuccess();
} }
// Delay notifyConnectionError after shutdownDone has been reported in the finally block.
if (writerException != null) {
notifyConnectionError(writerException);
}
} }
private void drainWriterQueueToUnacknowledgedStanzas() { private void drainWriterQueueToUnacknowledgedStanzas() {