Mercurial > pidgin
comparison src/protocols/oscar/conn.c @ 13260:2d5a1d2a520e
[gaim-migrate @ 15626]
Don't destroy connections until the cows come home
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 12 Feb 2006 23:19:36 +0000 |
parents | 3128ef5250ad |
children | b08f8f3c9197 |
comparison
equal
deleted
inserted
replaced
13259:3128ef5250ad | 13260:2d5a1d2a520e |
---|---|
96 aim_conn_addgroup(OscarConnection *conn, guint16 group) | 96 aim_conn_addgroup(OscarConnection *conn, guint16 group) |
97 { | 97 { |
98 aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; | 98 aim_conn_inside_t *ins = (aim_conn_inside_t *)conn->inside; |
99 struct snacgroup *sg; | 99 struct snacgroup *sg; |
100 | 100 |
101 sg = malloc(sizeof(struct snacgroup)); | 101 sg = g_new(struct snacgroup, 1); |
102 | 102 |
103 gaim_debug_misc("oscar", "adding group 0x%04x\n", group); | 103 gaim_debug_misc("oscar", "adding group 0x%04x\n", group); |
104 sg->group = group; | 104 sg->group = group; |
105 | 105 |
106 sg->next = ins->groups; | 106 sg->next = ins->groups; |
133 | 133 |
134 static void | 134 static void |
135 connkill_snacgroups(struct snacgroup *head) | 135 connkill_snacgroups(struct snacgroup *head) |
136 { | 136 { |
137 struct snacgroup *sg; | 137 struct snacgroup *sg; |
138 | |
139 for (sg = head; sg; ) | 138 for (sg = head; sg; ) |
140 { | 139 { |
141 struct snacgroup *tmp; | 140 struct snacgroup *tmp; |
142 | 141 |
143 tmp = sg->next; | 142 tmp = sg->next; |
184 * This will free ->internal if it necessary... | 183 * This will free ->internal if it necessary... |
185 */ | 184 */ |
186 if (conn->type == AIM_CONN_TYPE_CHAT) | 185 if (conn->type == AIM_CONN_TYPE_CHAT) |
187 aim_conn_kill_chat(sess, conn); | 186 aim_conn_kill_chat(sess, conn); |
188 | 187 |
189 if (conn->inside) | 188 if (conn->inside != NULL) |
190 { | 189 { |
191 aim_conn_inside_t *inside = (aim_conn_inside_t *)conn->inside; | 190 aim_conn_inside_t *inside = (aim_conn_inside_t *)conn->inside; |
192 | 191 |
193 connkill_snacgroups(inside->groups); | 192 connkill_snacgroups(inside->groups); |
194 connkill_rates(inside->rates); | 193 connkill_rates(inside->rates); |
196 free(inside); | 195 free(inside); |
197 } | 196 } |
198 | 197 |
199 gaim_circ_buffer_destroy(conn->buffer_outgoing); | 198 gaim_circ_buffer_destroy(conn->buffer_outgoing); |
200 g_free(conn); | 199 g_free(conn); |
200 | |
201 sess->oscar_connections = g_list_remove(sess->oscar_connections, conn); | |
201 } | 202 } |
202 | 203 |
203 /** | 204 /** |
204 * This sends an empty channel 4 SNAC. This is sent to signify | 205 * This sends an empty channel 4 SNAC. This is sent to signify |
205 * that we're logging off. This shouldn't really be necessary-- | 206 * that we're logging off. This shouldn't really be necessary-- |
259 aim_conn_kill(OscarSession *sess, OscarConnection *conn) | 260 aim_conn_kill(OscarSession *sess, OscarConnection *conn) |
260 { | 261 { |
261 if (!conn) | 262 if (!conn) |
262 return; | 263 return; |
263 | 264 |
264 sess->oscar_connections = g_list_remove(sess->oscar_connections, conn); | |
265 | |
266 oscar_connection_destroy(sess, conn); | 265 oscar_connection_destroy(sess, conn); |
267 } | 266 } |
268 | 267 |
269 /** | 268 /** |
270 * Close (but not free) a connection. | 269 * Close (but not free) a connection. |