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
1 changed files with 4 additions and 4 deletions

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() {