changeset 14161:694aae55ab6d

[gaim-migrate @ 16809] gaim_ssl_connect's are now cancelable (without crashing, anyway) This was relatively easy, because the PRPLs already keep a reference to the GaimSslConnection. I just needed to update the core ssl code to keep track of the GaimProxyConnectInfo, and to call gaim_proxy_connect_cancel() when gaim_ssl_close() is called committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 17 Aug 2006 05:47:58 +0000
parents c8ebbc0110f4
children cef7f6a93592
files plugins/ssl/ssl-gnutls.c
diffstat 1 files changed, 3 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/ssl/ssl-gnutls.c	Thu Aug 17 05:47:10 2006 +0000
+++ b/plugins/ssl/ssl-gnutls.c	Thu Aug 17 05:47:58 2006 +0000
@@ -100,27 +100,11 @@
 
 
 static void
-ssl_gnutls_connect_cb(gpointer data, gint source, GaimInputCondition cond)
+ssl_gnutls_connect(GaimSslConnection *gsc)
 {
-	GaimSslConnection *gsc = (GaimSslConnection *)data;
 	GaimSslGnutlsData *gnutls_data;
 	static const int cert_type_priority[2] = { GNUTLS_CRT_X509, 0 };
 
-	/*
-	 * TODO: Uh, this needs to somehow check to make sure that gsc is
-	 *       still valid before actually doing anything.
-	 */
-
-	if(source < 0) {
-		if(gsc->error_cb != NULL)
-			gsc->error_cb(gsc, GAIM_SSL_CONNECT_FAILED, gsc->connect_cb_data);
-
-		gaim_ssl_close(gsc);
-		return;
-	}
-
-	gsc->fd = source;
-
 	gnutls_data = g_new0(GaimSslGnutlsData, 1);
 	gsc->private_data = gnutls_data;
 
@@ -133,7 +117,7 @@
 	gnutls_credentials_set(gnutls_data->session, GNUTLS_CRD_CERTIFICATE,
 		xcred);
 
-	gnutls_transport_set_ptr(gnutls_data->session, GINT_TO_POINTER(source));
+	gnutls_transport_set_ptr(gnutls_data->session, GINT_TO_POINTER(gsc->fd));
 
 	gnutls_data->handshake_handler = gaim_input_add(gsc->fd,
 		GAIM_INPUT_READ, ssl_gnutls_handshake_cb, gsc);
@@ -204,7 +188,7 @@
 {
 	ssl_gnutls_init,
 	ssl_gnutls_uninit,
-	ssl_gnutls_connect_cb,
+	ssl_gnutls_connect,
 	ssl_gnutls_close,
 	ssl_gnutls_read,
 	ssl_gnutls_write