From d54dafc499403435f23712830cc5a7501d0fd3e1 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 25 Jun 2015 11:07:25 +0200 Subject: [PATCH] Don't return if securityMode is 'disabled' in afterFeaturesReceived. As this will cause maybeCompressFeaturesReceived.reportSuccess() never to be called if the server announces 'starttls' but security mode is set to 'disabled' and if 'compression' is also announced. Fixes SMACK-678. --- .../java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 6 ++---- 1 file changed, 2 insertions(+), 4 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 64de91db5..afa817fc3 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 @@ -884,11 +884,9 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { return; } - if (config.getSecurityMode() == ConnectionConfiguration.SecurityMode.disabled) { - // Do not secure the connection using TLS since TLS was disabled - return; + if (config.getSecurityMode() != ConnectionConfiguration.SecurityMode.disabled) { + send(new StartTls()); } - send(new StartTls()); } // If TLS is required but the server doesn't offer it, disconnect // from the server and throw an error. First check if we've already negotiated TLS