Mercurial > pidgin.yaz
comparison libpurple/protocols/myspace/myspace.c @ 17906:814992cefc9c
Add a bunch of debugging to help fix #193.
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Mon, 25 Jun 2007 05:11:34 +0000 |
parents | 7b890c79aabf |
children | 8ee3fd09a543 |
comparison
equal
deleted
inserted
replaced
17905:7b890c79aabf | 17906:814992cefc9c |
---|---|
1521 /* Destroy session if fatal. */ | 1521 /* Destroy session if fatal. */ |
1522 if (msim_msg_get(msg, "fatal")) | 1522 if (msim_msg_get(msg, "fatal")) |
1523 { | 1523 { |
1524 purple_debug_info("msim", "fatal error, closing\n"); | 1524 purple_debug_info("msim", "fatal error, closing\n"); |
1525 purple_connection_error(session->gc, full_errmsg); | 1525 purple_connection_error(session->gc, full_errmsg); |
1526 | |
1527 msim_close(session->gc); | |
1528 } | 1526 } |
1529 | 1527 |
1530 return TRUE; | 1528 return TRUE; |
1531 } | 1529 } |
1532 | 1530 |
1980 if (session->rxoff == MSIM_READ_BUF_SIZE) | 1978 if (session->rxoff == MSIM_READ_BUF_SIZE) |
1981 { | 1979 { |
1982 purple_debug_error("msim", "msim_input_cb: %d-byte read buffer full!\n", | 1980 purple_debug_error("msim", "msim_input_cb: %d-byte read buffer full!\n", |
1983 MSIM_READ_BUF_SIZE); | 1981 MSIM_READ_BUF_SIZE); |
1984 purple_connection_error(gc, _("Read buffer full")); | 1982 purple_connection_error(gc, _("Read buffer full")); |
1985 | |
1986 msim_close(session->gc); | |
1987 return; | 1983 return; |
1988 } | 1984 } |
1989 | 1985 |
1990 purple_debug_info("msim", "buffer at %d (max %d), reading up to %d\n", | 1986 purple_debug_info("msim", "buffer at %d (max %d), reading up to %d\n", |
1991 session->rxoff, MSIM_READ_BUF_SIZE, | 1987 session->rxoff, MSIM_READ_BUF_SIZE, |
2000 { | 1996 { |
2001 return; | 1997 return; |
2002 } | 1998 } |
2003 else if (n < 0) | 1999 else if (n < 0) |
2004 { | 2000 { |
2005 purple_connection_error(gc, _("Read error")); | |
2006 purple_debug_error("msim", "msim_input_cb: read error, ret=%d, " | 2001 purple_debug_error("msim", "msim_input_cb: read error, ret=%d, " |
2007 "error=%s, source=%d, fd=%d (%X))\n", | 2002 "error=%s, source=%d, fd=%d (%X))\n", |
2008 n, strerror(errno), source, session->fd, session->fd); | 2003 n, strerror(errno), source, session->fd, session->fd); |
2009 | 2004 purple_connection_error(gc, _("Read error")); |
2010 msim_close(session->gc); | |
2011 return; | 2005 return; |
2012 } | 2006 } |
2013 else if (n == 0) | 2007 else if (n == 0) |
2014 { | 2008 { |
2015 purple_debug_info("msim", "msim_input_cb: server disconnected\n"); | 2009 purple_debug_info("msim", "msim_input_cb: server disconnected\n"); |
2175 * @param session The session to destroy. | 2169 * @param session The session to destroy. |
2176 */ | 2170 */ |
2177 void | 2171 void |
2178 msim_session_destroy(MsimSession *session) | 2172 msim_session_destroy(MsimSession *session) |
2179 { | 2173 { |
2174 purple_debug_info("msim", ">>> going to check if valid\n"); | |
2175 | |
2180 g_return_if_fail(MSIM_SESSION_VALID(session)); | 2176 g_return_if_fail(MSIM_SESSION_VALID(session)); |
2177 | |
2178 purple_debug_info("msim", ">>> going to set magic\n"); | |
2181 | 2179 |
2182 session->magic = -1; | 2180 session->magic = -1; |
2183 | 2181 |
2182 purple_debug_info("msim", ">>> going to free rxbuf\n"); | |
2184 g_free(session->rxbuf); | 2183 g_free(session->rxbuf); |
2185 | 2184 |
2186 /* TODO: Remove. */ | 2185 /* TODO: Remove. */ |
2186 purple_debug_info("msim", ">>> going to free user_lookup_cb\n"); | |
2187 g_hash_table_destroy(session->user_lookup_cb); | 2187 g_hash_table_destroy(session->user_lookup_cb); |
2188 purple_debug_info("msim", ">>> going to free user_lookup_cb_data\n"); | |
2188 g_hash_table_destroy(session->user_lookup_cb_data); | 2189 g_hash_table_destroy(session->user_lookup_cb_data); |
2189 | 2190 |
2191 purple_debug_info("msim", ">>> going to free session itself\n"); | |
2190 g_free(session); | 2192 g_free(session); |
2191 } | 2193 } |
2192 | 2194 |
2193 /** | 2195 /** |
2194 * Close the connection. | 2196 * Close the connection. |
2198 void | 2200 void |
2199 msim_close(PurpleConnection *gc) | 2201 msim_close(PurpleConnection *gc) |
2200 { | 2202 { |
2201 MsimSession *session; | 2203 MsimSession *session; |
2202 | 2204 |
2203 purple_debug_info("msim", "msim_close: destroying session\n"); | 2205 purple_debug_info("msim", "msim_close: closing, gc=0x%x\n", gc); |
2204 | 2206 |
2207 if (gc == NULL) | |
2208 return; | |
2209 | |
2210 purple_debug_info("msim", "msim_close: dereferencing gc->proto_data\n"); | |
2205 session = (MsimSession *)gc->proto_data; | 2211 session = (MsimSession *)gc->proto_data; |
2206 | 2212 if (session == NULL) |
2207 g_return_if_fail(gc != NULL); | 2213 return; |
2208 g_return_if_fail(session != NULL); | 2214 |
2209 g_return_if_fail(MSIM_SESSION_VALID(session)); | 2215 gc->proto_data = NULL; |
2210 | 2216 |
2211 purple_input_remove(session->gc->inpa); | 2217 purple_debug_info("msim", "msim_close: checking if session is valid\n"); |
2218 if (!MSIM_SESSION_VALID(session)) | |
2219 return; | |
2220 | |
2221 purple_debug_info("msim", "msim_close: about to remove inpa\n"); | |
2222 if (session->gc->inpa) | |
2223 purple_input_remove(session->gc->inpa); | |
2224 | |
2225 purple_debug_info("msim", "msim_close: ready to destroy session\n"); | |
2212 msim_session_destroy(session); | 2226 msim_session_destroy(session); |
2213 } | 2227 } |
2214 | 2228 |
2215 | 2229 |
2216 /** | 2230 /** |