diff src/protocols/msn/httpconn.c @ 14112:e149556f7569

[gaim-migrate @ 16746] Alright, SVN gaim_proxy_connect()'s are good committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 14 Aug 2006 07:00:26 +0000
parents 7a205b430d19
children
line wrap: on
line diff
--- a/src/protocols/msn/httpconn.c	Mon Aug 14 06:38:12 2006 +0000
+++ b/src/protocols/msn/httpconn.c	Mon Aug 14 07:00:26 2006 +0000
@@ -693,21 +693,12 @@
 }
 
 static void
-connect_cb(gpointer data, gint source)
+connect_cb(gpointer data, gint source, const gchar *error_message)
 {
-	MsnHttpConn *httpconn = data;
+	MsnHttpConn *httpconn;
 
-	/*
-	TODO: Need to do this in case the account is disabled while connecting
-	if (!g_list_find(gaim_connections_get_all(), gc))
-	{
-		if (source >= 0)
-			close(source);
-		destroy_new_conn_data(new_conn_data);
-		return;
-	}
-	*/
-
+	httpconn = data;
+	httpconn->connect_info = NULL;
 	httpconn->fd = source;
 
 	if (source >= 0)
@@ -729,8 +720,6 @@
 gboolean
 msn_httpconn_connect(MsnHttpConn *httpconn, const char *host, int port)
 {
-	GaimProxyConnectInfo *connect_info;
-
 	g_return_val_if_fail(httpconn != NULL, FALSE);
 	g_return_val_if_fail(host     != NULL, FALSE);
 	g_return_val_if_fail(port      > 0,    FALSE);
@@ -738,10 +727,10 @@
 	if (httpconn->connected)
 		msn_httpconn_disconnect(httpconn);
 
-	connect_info = gaim_proxy_connect(httpconn->session->account,
+	httpconn->connect_info = gaim_proxy_connect(httpconn->session->account,
 		"gateway.messenger.hotmail.com", 80, connect_cb, httpconn);
 
-	if (connect_info != NULL)
+	if (httpconn->connect_info != NULL)
 	{
 		httpconn->waiting_response = TRUE;
 		httpconn->connected = TRUE;
@@ -758,10 +747,17 @@
 	if (!httpconn->connected)
 		return;
 
+	if (httpconn->connect_info != NULL)
+	{
+		gaim_proxy_connect_cancel(httpconn->connect_info);
+		httpconn->connect_info = NULL;
+	}
+
 	if (httpconn->timer)
+	{
 		gaim_timeout_remove(httpconn->timer);
-
-	httpconn->timer = 0;
+		httpconn->timer = 0;
+	}
 
 	if (httpconn->inpa > 0)
 	{
@@ -770,6 +766,7 @@
 	}
 
 	close(httpconn->fd);
+	httpconn->fd = -1;
 
 	g_free(httpconn->rx_buf);
 	httpconn->rx_buf = NULL;