conn: implemented old-style SSL connection

Added new API xmpp_conn_set_old_style_ssl(). This function forces
using of old-style SSL connection.
This commit is contained in:
Dmitry Podgorny
2015-10-12 22:16:23 +03:00
parent 254b9d73a1
commit 36af7afa27
7 changed files with 140 additions and 55 deletions

View File

@@ -258,9 +258,10 @@ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout)
/* connection complete */
/* check for error */
if (sock_connect_error(conn->sock) != 0) {
ret = sock_connect_error(conn->sock);
if (ret != 0) {
/* connection failed */
xmpp_debug(ctx, "xmpp", "connection failed");
xmpp_debug(ctx, "xmpp", "connection failed, error %d", ret);
conn_disconnect(conn);
break;
}
@@ -268,7 +269,15 @@ void xmpp_run_once(xmpp_ctx_t *ctx, const unsigned long timeout)
conn->state = XMPP_STATE_CONNECTED;
xmpp_debug(ctx, "xmpp", "connection successful");
if (conn->tls_is_old_ssl) {
xmpp_debug(ctx, "xmpp", "using old style SSL connection");
ret = conn_tls_start(conn);
if (ret != 0) {
conn_disconnect(conn);
break;
}
}
/* send stream init */
conn_open_stream(conn);
}