# HG changeset patch # User Mark Doliner # Date 1156128134 0 # Node ID 1f963d406bb424abcd09b2214ff78a8bc198c9d4 # Parent 9c371189d7d6d81390db0234e90e24cce8d36723 [gaim-migrate @ 16932] More sslconn improvements committer: Tailor Script diff -r 9c371189d7d6 -r 1f963d406bb4 libgaim/protocols/jabber/jabber.c --- a/libgaim/protocols/jabber/jabber.c Mon Aug 21 02:21:51 2006 +0000 +++ b/libgaim/protocols/jabber/jabber.c Mon Aug 21 02:42:14 2006 +0000 @@ -407,13 +407,6 @@ GaimConnection *gc = data; JabberStream *js = gc->proto_data; - if(!g_list_find(gaim_connections_get_all(), gc)) { - gaim_ssl_close(gsc); - return; - } - - js->gsc = gsc; - if(js->state == JABBER_STREAM_CONNECTING) jabber_send_raw(js, "", -1); jabber_stream_set_state(js, JABBER_STREAM_INITIALIZING); @@ -450,6 +443,8 @@ GaimConnection *gc = data; JabberStream *js = gc->proto_data; + js->gsc = NULL; + switch(error) { case GAIM_SSL_CONNECT_FAILED: gaim_connection_error(gc, _("Connection Failed")); @@ -458,8 +453,6 @@ gaim_connection_error(gc, _("SSL Handshake Failed")); break; } - - js->gsc = NULL; } static void tls_init(JabberStream *js) diff -r 9c371189d7d6 -r 1f963d406bb4 libgaim/protocols/novell/novell.c --- a/libgaim/protocols/novell/novell.c Mon Aug 21 02:21:51 2006 +0000 +++ b/libgaim/protocols/novell/novell.c Mon Aug 21 02:42:14 2006 +0000 @@ -1663,8 +1663,14 @@ novell_ssl_connect_error(GaimSslConnection * gsc, GaimSslErrorType error, gpointer data) { - gaim_connection_error((GaimConnection *)data, - _("Unable to make SSL connection to server.")); + GaimConnection *gc; + NMUser *user; + + gc = data; + user = gc->proto_data; + user->conn->ssl_conn->data = NULL; + + gaim_connection_error(gc, _("Unable to make SSL connection to server.")); } static void @@ -1717,7 +1723,6 @@ return; conn->ssl_conn = g_new0(NMSSLConn, 1); - conn->ssl_conn->data = gsc; conn->ssl_conn->read = (nm_ssl_read_cb) gaim_ssl_read; conn->ssl_conn->write = (nm_ssl_write_cb) gaim_ssl_write; @@ -2182,9 +2187,10 @@ 1, NOVELL_CONNECT_STEPS); user->conn->use_ssl = TRUE; - if (gaim_ssl_connect(user->client_data, user->conn->addr, - user->conn->port, novell_ssl_connected_cb, - novell_ssl_connect_error, gc) == NULL) { + user->conn->ssl_conn->data = gaim_ssl_connect(user->client_data, + user->conn->addr, user->conn->port, + novell_ssl_connected_cb, novell_ssl_connect_error, gc); + if (user->conn->ssl_conn->data == NULL) { gaim_connection_error(gc, _("Error." " SSL support is not installed.")); } diff -r 9c371189d7d6 -r 1f963d406bb4 libgaim/sslconn.h --- a/libgaim/sslconn.h Mon Aug 21 02:21:51 2006 +0000 +++ b/libgaim/sslconn.h Mon Aug 21 02:42:14 2006 +0000 @@ -92,13 +92,18 @@ gboolean gaim_ssl_is_supported(void); /** - * Makes a SSL connection to the specified host and port. + * Makes a SSL connection to the specified host and port. The caller + * should keep track of the returned value and use it to cancel the + * connection, if needed. * * @param account The account making the connection. * @param host The destination host. * @param port The destination port. * @param func The SSL input handler function. - * @param error_func The SSL error handler function. + * @param error_func The SSL error handler function. This function + * should NOT call gaim_ssl_close(). In the event + * of an error the GaimSslConnection will be + * destroyed for you. * @param data User-defined data. * * @return The SSL connection handle.