mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 06:12:05 +01:00
Replace shutdownInProgress with queue status
This commit is contained in:
parent
bad52fad21
commit
a854e04d28
1 changed files with 2 additions and 11 deletions
|
@ -466,19 +466,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
shutdown(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>true</code> if this connection is currently disconnecting the session by performing a
|
||||
* shut down.
|
||||
*/
|
||||
private volatile boolean shutdownInProgress;
|
||||
|
||||
private void shutdown(boolean instant) {
|
||||
if (disconnectedButResumeable) {
|
||||
return;
|
||||
}
|
||||
|
||||
shutdownInProgress = true;
|
||||
|
||||
// First shutdown the writer, this will result in a closing stream element getting send to
|
||||
// the server
|
||||
if (packetWriter != null) {
|
||||
|
@ -512,7 +504,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
// stream tag, there is no longer a stream to resume.
|
||||
smSessionId = null;
|
||||
}
|
||||
shutdownInProgress = false;
|
||||
authenticated = false;
|
||||
connected = false;
|
||||
usingTLS = false;
|
||||
|
@ -1125,7 +1116,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
case XmlPullParser.END_TAG:
|
||||
if (parser.getName().equals("stream")) {
|
||||
closingStreamReceived.reportSuccess();
|
||||
if (shutdownInProgress) {
|
||||
if (packetWriter.queue.isShutdown()) {
|
||||
// We received a closing stream element *after* we initiated the
|
||||
// termination of the session by sending a closing stream element to
|
||||
// the server first
|
||||
|
@ -1255,8 +1246,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
*/
|
||||
void shutdown(boolean instant) {
|
||||
instantShutdown = instant;
|
||||
shutdownTimestamp = System.currentTimeMillis();
|
||||
queue.shutdown();
|
||||
shutdownTimestamp = System.currentTimeMillis();
|
||||
try {
|
||||
shutdownDone.checkIfSuccessOrWait();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue