comparison libpurple/protocols/oscar/flap_connection.c @ 27240:75aaadd295ed

Stop the watchers before closing the fds
author Mark Doliner <mark@kingant.net>
date Tue, 23 Jun 2009 17:39:00 +0000
parents 454d46e9cbb7
children 7054f810b0f9
comparison
equal deleted inserted replaced
27239:4a62072ea833 27240:75aaadd295ed
353 oscar_chat_destroy(conn->new_conn_data); 353 oscar_chat_destroy(conn->new_conn_data);
354 conn->new_conn_data = NULL; 354 conn->new_conn_data = NULL;
355 } 355 }
356 } 356 }
357 357
358 if ((conn->fd >= 0 || conn->gsc != NULL)
359 && conn->type == SNAC_FAMILY_LOCATE)
360 flap_connection_send_close(od, conn);
361
362 if (conn->watcher_incoming != 0)
363 {
364 purple_input_remove(conn->watcher_incoming);
365 conn->watcher_incoming = 0;
366 }
367
368 if (conn->watcher_outgoing != 0)
369 {
370 purple_input_remove(conn->watcher_outgoing);
371 conn->watcher_outgoing = 0;
372 }
373
358 if (conn->fd >= 0) 374 if (conn->fd >= 0)
359 { 375 {
360 if (conn->type == SNAC_FAMILY_LOCATE)
361 flap_connection_send_close(od, conn);
362
363 close(conn->fd); 376 close(conn->fd);
364 conn->fd = -1; 377 conn->fd = -1;
365 } 378 }
366 379
367 if (conn->gsc != NULL) 380 if (conn->gsc != NULL)
368 { 381 {
369 if (conn->type == SNAC_FAMILY_LOCATE)
370 flap_connection_send_close(od, conn);
371
372 purple_ssl_close(conn->gsc); 382 purple_ssl_close(conn->gsc);
373 conn->gsc = NULL; 383 conn->gsc = NULL;
374 }
375
376 if (conn->watcher_incoming != 0)
377 {
378 purple_input_remove(conn->watcher_incoming);
379 conn->watcher_incoming = 0;
380 }
381
382 if (conn->watcher_outgoing != 0)
383 {
384 purple_input_remove(conn->watcher_outgoing);
385 conn->watcher_outgoing = 0;
386 } 384 }
387 385
388 g_free(conn->buffer_incoming.data.data); 386 g_free(conn->buffer_incoming.data.data);
389 conn->buffer_incoming.data.data = NULL; 387 conn->buffer_incoming.data.data = NULL;
390 388