From a8429d45f655abb5e58f7a35175937fd4658367d Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 3 Jan 2017 11:44:44 +0100 Subject: [PATCH] Do not wait for the closing stream element on instant shutdown --- .../smack/tcp/XMPPTCPConnection.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index 8e843a805..61fe86a3b 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -484,14 +484,16 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { } LOGGER.finer("PacketWriter has been shut down"); - try { - // After we send the closing stream element, check if there was already a - // closing stream element sent by the server or wait with a timeout for a - // closing stream element to be received from the server. - @SuppressWarnings("unused") - Exception res = closingStreamReceived.checkIfSuccessOrWait(); - } catch (InterruptedException | NoResponseException e) { - LOGGER.log(Level.INFO, "Exception while waiting for closing stream element from the server " + this, e); + if (!instant) { + try { + // After we send the closing stream element, check if there was already a + // closing stream element sent by the server or wait with a timeout for a + // closing stream element to be received from the server. + @SuppressWarnings("unused") + Exception res = closingStreamReceived.checkIfSuccessOrWait(); + } catch (InterruptedException | NoResponseException e) { + LOGGER.log(Level.INFO, "Exception while waiting for closing stream element from the server " + this, e); + } } if (packetReader != null) {