mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 03:52:06 +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);
|
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) {
|
private void shutdown(boolean instant) {
|
||||||
if (disconnectedButResumeable) {
|
if (disconnectedButResumeable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
shutdownInProgress = true;
|
|
||||||
|
|
||||||
// First shutdown the writer, this will result in a closing stream element getting send to
|
// First shutdown the writer, this will result in a closing stream element getting send to
|
||||||
// the server
|
// the server
|
||||||
if (packetWriter != null) {
|
if (packetWriter != null) {
|
||||||
|
@ -512,7 +504,6 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
// stream tag, there is no longer a stream to resume.
|
// stream tag, there is no longer a stream to resume.
|
||||||
smSessionId = null;
|
smSessionId = null;
|
||||||
}
|
}
|
||||||
shutdownInProgress = false;
|
|
||||||
authenticated = false;
|
authenticated = false;
|
||||||
connected = false;
|
connected = false;
|
||||||
usingTLS = false;
|
usingTLS = false;
|
||||||
|
@ -1125,7 +1116,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
case XmlPullParser.END_TAG:
|
case XmlPullParser.END_TAG:
|
||||||
if (parser.getName().equals("stream")) {
|
if (parser.getName().equals("stream")) {
|
||||||
closingStreamReceived.reportSuccess();
|
closingStreamReceived.reportSuccess();
|
||||||
if (shutdownInProgress) {
|
if (packetWriter.queue.isShutdown()) {
|
||||||
// We received a closing stream element *after* we initiated the
|
// We received a closing stream element *after* we initiated the
|
||||||
// termination of the session by sending a closing stream element to
|
// termination of the session by sending a closing stream element to
|
||||||
// the server first
|
// the server first
|
||||||
|
@ -1255,8 +1246,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
||||||
*/
|
*/
|
||||||
void shutdown(boolean instant) {
|
void shutdown(boolean instant) {
|
||||||
instantShutdown = instant;
|
instantShutdown = instant;
|
||||||
shutdownTimestamp = System.currentTimeMillis();
|
|
||||||
queue.shutdown();
|
queue.shutdown();
|
||||||
|
shutdownTimestamp = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
shutdownDone.checkIfSuccessOrWait();
|
shutdownDone.checkIfSuccessOrWait();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue