1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-25 21:42:07 +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; writer = null;
initState(); initState();
// Wait for reader and writer threads to be terminated.
readerWriterSemaphore.acquireUninterruptibly(2);
readerWriterSemaphore.release(2);
} }
@Override @Override
@ -978,10 +982,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
// Note that a connection listener of XMPPTCPConnection will drop the SM state in // Note that a connection listener of XMPPTCPConnection will drop the SM state in
// case the Exception is a StreamErrorException. // case the Exception is a StreamErrorException.
instantShutdown(); instantShutdown();
// Wait for reader and writer threads to be terminated.
readerWriterSemaphore.acquireUninterruptibly(2);
readerWriterSemaphore.release(2);
} }
Async.go(new Runnable() { Async.go(new Runnable() {