diff --git a/src/java/org/jivesoftware/multiplexer/net/StanzaHandler.java b/src/java/org/jivesoftware/multiplexer/net/StanzaHandler.java index 6c9b522..7a36597 100644 --- a/src/java/org/jivesoftware/multiplexer/net/StanzaHandler.java +++ b/src/java/org/jivesoftware/multiplexer/net/StanzaHandler.java @@ -44,6 +44,9 @@ // DANIELE: Indicate if a session is already created private boolean sessionCreated = false; + // Flag that indicates that the client requested to use TLS and TLS has been negotiated. Once the + // client sent a new initial stream header the value will return to false. + private boolean startedTLS = false; // Flag that indicates that the client requested to be authenticated. Once the // authentication process is over the value will return to false. private boolean startedSASL = false; @@ -102,6 +105,9 @@ sessionCreated = true; parser.setInput(new StringReader(stanza)); createSession(parser); + } else if (startedTLS) { + startedTLS = false; + tlsNegotiated(); } else if (startedSASL && session.getStatus() == Session.STATUS_AUTHENTICATED) { startedSASL = false; saslSuccessful(); @@ -141,7 +147,7 @@ if ("starttls".equals(tag)) { // Negotiate TLS if (negotiateTLS()) { - tlsNegotiated(); + startedTLS= true; } else { connection.close(); session = null;