# HG changeset patch # User Mark Doliner # Date 1155538826 0 # Node ID e149556f75697b6ebb4d1a7e1cb9511dd1a4b573 # Parent c44af67e2065aa288f6e02286207201fdb11c862 [gaim-migrate @ 16746] Alright, SVN gaim_proxy_connect()'s are good committer: Tailor Script diff -r c44af67e2065 -r e149556f7569 src/protocols/msn/directconn.c --- a/src/protocols/msn/directconn.c Mon Aug 14 06:38:12 2006 +0000 +++ b/src/protocols/msn/directconn.c Mon Aug 14 07:00:26 2006 +0000 @@ -288,11 +288,6 @@ /* ERROR */ gaim_debug_error("msn", "error reading\n"); - if (directconn->inpa) - gaim_input_remove(directconn->inpa); - - close(directconn->fd); - msn_directconn_destroy(directconn); return; @@ -307,11 +302,6 @@ /* ERROR */ gaim_debug_error("msn", "error reading\n"); - if (directconn->inpa) - gaim_input_remove(directconn->inpa); - - close(directconn->fd); - msn_directconn_destroy(directconn); return; @@ -358,17 +348,12 @@ /* ERROR */ gaim_debug_error("msn", "error reading\n"); - if (directconn->inpa) - gaim_input_remove(directconn->inpa); - - close(directconn->fd); - msn_directconn_destroy(directconn); } } static void -connect_cb(gpointer data, gint source) +connect_cb(gpointer data, gint source, const gchar *error_message) { MsnDirectConn* directconn; int fd; @@ -376,6 +361,7 @@ gaim_debug_misc("msn", "directconn: connect_cb: %d\n", source); directconn = data; + directconn->connect_info = NULL; if (TRUE) { @@ -423,7 +409,6 @@ msn_directconn_connect(MsnDirectConn *directconn, const char *host, int port) { MsnSession *session; - GaimProxyConnectInfo *connect_info; g_return_val_if_fail(directconn != NULL, FALSE); g_return_val_if_fail(host != NULL, TRUE); @@ -438,10 +423,10 @@ } #endif - connect_info = gaim_proxy_connect(session->account, host, port, + directconn->connect_info = gaim_proxy_connect(session->account, host, port, connect_cb, directconn); - if (connect_info != NULL) + if (directconn->connect_info != NULL) { return TRUE; } @@ -491,6 +476,15 @@ void msn_directconn_destroy(MsnDirectConn *directconn) { + if (directconn->connect_info != NULL) + gaim_proxy_connect_cancel(directconn->connect_info); + + if (directconn->inpa != 0) + gaim_input_remove(directconn->inpa); + + if (directconn->fd >= 0) + close(directconn->fd); + if (directconn->nonce != NULL) g_free(directconn->nonce); diff -r c44af67e2065 -r e149556f7569 src/protocols/msn/directconn.h --- a/src/protocols/msn/directconn.h Mon Aug 14 06:38:12 2006 +0000 +++ b/src/protocols/msn/directconn.h Mon Aug 14 07:00:26 2006 +0000 @@ -35,6 +35,8 @@ MsnSlpLink *slplink; MsnSlpCall *initial_call; + GaimProxyConnectInfo *connect_info; + gboolean acked; char *nonce; diff -r c44af67e2065 -r e149556f7569 src/protocols/msn/httpconn.c --- 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; diff -r c44af67e2065 -r e149556f7569 src/protocols/msn/httpconn.h --- a/src/protocols/msn/httpconn.h Mon Aug 14 06:38:12 2006 +0000 +++ b/src/protocols/msn/httpconn.h Mon Aug 14 07:00:26 2006 +0000 @@ -37,6 +37,8 @@ MsnSession *session; /**< The MSN Session. */ MsnServConn *servconn; /**< The connection object. */ + GaimProxyConnectInfo *connect_info; + char *full_session_id; /**< The full session id. */ char *session_id; /**< The trimmed session id. */ diff -r c44af67e2065 -r e149556f7569 src/protocols/msn/servconn.c --- a/src/protocols/msn/servconn.c Mon Aug 14 06:38:12 2006 +0000 +++ b/src/protocols/msn/servconn.c Mon Aug 14 07:00:26 2006 +0000 @@ -166,10 +166,12 @@ **************************************************************************/ static void -connect_cb(gpointer data, gint source) +connect_cb(gpointer data, gint source, const gchar *error_message) { - MsnServConn *servconn = data; + MsnServConn *servconn; + servconn = data; + servconn->connect_info = NULL; servconn->processing = FALSE; if (servconn->wasted) @@ -199,7 +201,6 @@ msn_servconn_connect(MsnServConn *servconn, const char *host, int port) { MsnSession *session; - GaimProxyConnectInfo *connect_info; g_return_val_if_fail(servconn != NULL, FALSE); g_return_val_if_fail(host != NULL, FALSE); @@ -232,10 +233,10 @@ return TRUE; } - connect_info = gaim_proxy_connect(session->account, host, port, + servconn->connect_info = gaim_proxy_connect(session->account, host, port, connect_cb, servconn); - if (connect_info != NULL) + if (servconn->connect_info != NULL) { servconn->processing = TRUE; return TRUE; @@ -267,6 +268,12 @@ return; } + if (servconn->connect_info != NULL) + { + gaim_proxy_connect_cancel(servconn->connect_info); + servconn->connect_info = NULL; + } + if (servconn->inpa > 0) { gaim_input_remove(servconn->inpa); diff -r c44af67e2065 -r e149556f7569 src/protocols/msn/servconn.h --- a/src/protocols/msn/servconn.h Mon Aug 14 06:38:12 2006 +0000 +++ b/src/protocols/msn/servconn.h Mon Aug 14 07:00:26 2006 +0000 @@ -63,6 +63,8 @@ MsnSession *session; /**< The MSN session of this connection. */ MsnCmdProc *cmdproc; /**< The command processor of this connection. */ + GaimProxyConnectInfo *connect_info; + gboolean connected; /**< A flag that states if it's connected. */ gboolean processing; /**< A flag that states if something is working with this connection. */