From 765e83ca81ccbbc5b61f2a3a70680344f284eda3 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 28 Oct 2014 12:22:16 +0100 Subject: [PATCH] Send a final SM Ack on shutdown() --- .../org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 8e438070d..d1db32361 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 @@ -487,6 +487,15 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { */ @Override protected void shutdown() { + if (isSmEnabled()) { + try { + // Try to send a last SM Acknowledgement. Most servers won't find this information helpful, as the SM + // state is dropped after a clean disconnect anyways. OTOH it doesn't hurt much either. + sendSmAcknowledgementInternal(); + } catch (NotConnectedException e) { + LOGGER.log(Level.FINE, "Can not send final SM ack as connection is not connected", e); + } + } shutdown(false); }