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

Synchronize later in notifyConnectionError(Exception)

especially *after* the sync points have been notified so that a
potential thread currently callin gconnect()/login() throws and leaves
the synchronized section.

This commit is more or less equivalent to
3ded023629 of the 4.3 branch.
This commit is contained in:
Florian Schmaus 2019-03-16 10:30:16 +01:00
parent daab6039a1
commit 8e52e80399

View file

@ -858,9 +858,6 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
ASYNC_BUT_ORDERED.performAsyncButOrdered(this, () -> { ASYNC_BUT_ORDERED.performAsyncButOrdered(this, () -> {
currentConnectionException = exception; currentConnectionException = exception;
synchronized (AbstractXMPPConnection.this) {
notifyAll();
}
for (StanzaCollector collector : collectors) { for (StanzaCollector collector : collectors) {
collector.notifyConnectionError(exception); collector.notifyConnectionError(exception);
@ -873,10 +870,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
// XMPPTCPConnection. Create delegation method? // XMPPTCPConnection. Create delegation method?
// maybeCompressFeaturesReceived.reportGenericFailure(smackWrappedException); // maybeCompressFeaturesReceived.reportGenericFailure(smackWrappedException);
synchronized (AbstractXMPPConnection.this) {
notifyAll();
// Closes the connection temporary. A if the connection supports stream management, then a reconnection is // Closes the connection temporary. A if the connection supports stream management, then a reconnection is
// possible. Note that a connection listener of e.g. XMPPTCPConnection will drop the SM state in // possible. Note that a connection listener of e.g. XMPPTCPConnection will drop the SM state in
// case the Exception is a StreamErrorException. // case the Exception is a StreamErrorException.
instantShutdown(); instantShutdown();
}
Async.go(() -> { Async.go(() -> {
// Notify connection listeners of the error. // Notify connection listeners of the error.