1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 12:37:58 +01:00

Wait for reader/writer thread termination at the end of shutdown()

This synchronizes the place with what the master branch currently
does.
This commit is contained in:
Florian Schmaus 2019-03-16 11:11:58 +01:00
parent 3ded023629
commit 7059b60672

View file

@ -561,6 +561,10 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
writer = null;
initState();
// Wait for reader and writer threads to be terminated.
readerWriterSemaphore.acquireUninterruptibly(2);
readerWriterSemaphore.release(2);
}
@Override
@ -978,10 +982,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
// Note that a connection listener of XMPPTCPConnection will drop the SM state in
// case the Exception is a StreamErrorException.
instantShutdown();
// Wait for reader and writer threads to be terminated.
readerWriterSemaphore.acquireUninterruptibly(2);
readerWriterSemaphore.release(2);
}
Async.go(new Runnable() {