diff options
author | Vitaly Takmazov | 2018-07-30 16:26:06 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-07-30 16:26:06 +0300 |
commit | 12ae70b2659772a591000c378802e94e19f48829 (patch) | |
tree | d50b87eb87a40af096fd519103fa341394adc909 /juick-server | |
parent | 30920154fde5a849edf5554801b585e80c9f03f2 (diff) |
XMPP: trying to report STARTTLS failure before closing socket
Diffstat (limited to 'juick-server')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/XMPPServer.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/juick-server/src/main/java/com/juick/server/XMPPServer.java b/juick-server/src/main/java/com/juick/server/XMPPServer.java index 643bc37b..9dc7bf0a 100644 --- a/juick-server/src/main/java/com/juick/server/XMPPServer.java +++ b/juick-server/src/main/java/com/juick/server/XMPPServer.java @@ -310,7 +310,7 @@ public class XMPPServer implements ConnectionListener, AutoCloseable { connection.sendStanza("<proceed xmlns=\"" + Connection.NS_TLS + "\" />"); try { connection.setSocket(sc.getSocketFactory().createSocket(connection.getSocket(), connection.getSocket().getInetAddress().getHostAddress(), - connection.getSocket().getPort(), true)); + connection.getSocket().getPort(), false)); SSLSocket sslSocket = (SSLSocket) connection.getSocket(); sslSocket.addHandshakeCompletedListener(handshakeCompletedEvent -> { try { @@ -330,7 +330,7 @@ public class XMPPServer implements ConnectionListener, AutoCloseable { connection.restartParser(); } catch (XmlPullParserException | IOException sex) { logger.warn("stream {} ssl error {}", connection.streamID, sex); - connection.sendStanza("<failed xmlns\"" + Connection.NS_TLS + "\" />"); + connection.sendStanza("<failure xmlns=\"" + Connection.NS_TLS + "\" />"); removeConnectionIn(connection); connection.closeConnection(); } @@ -341,7 +341,7 @@ public class XMPPServer implements ConnectionListener, AutoCloseable { try { Socket socket = outConnections.get(connection).get(); socket = sc.getSocketFactory().createSocket(socket, socket.getInetAddress().getHostAddress(), - socket.getPort(), true); + socket.getPort(), false); SSLSocket sslSocket = (SSLSocket) socket; sslSocket.addHandshakeCompletedListener(handshakeCompletedEvent -> { try { @@ -363,7 +363,7 @@ public class XMPPServer implements ConnectionListener, AutoCloseable { connection.sendOpenStream(); } catch (NoSuchElementException | XmlPullParserException | IOException sex) { logger.error("s2s ssl error: {} {}, error {}", connection.to, connection.getStreamID(), sex); - connection.send("<failed xmlns\"" + Connection.NS_TLS + "\" />"); + connection.send("<failure xmlns=\"" + Connection.NS_TLS + "\" />"); removeConnectionOut(connection); connection.logoff(); } |