# HG changeset patch # User Mark Doliner # Date 1129529462 0 # Node ID b37c439dfcc062eb816430b6e6845fb61b120977 # Parent 8004885fabbe2a529d1ac8ae486742aff61e8378 [gaim-migrate @ 13964] Modify the Bonjour PRPL to use gc->inpa, gaim_input_add, and to stop watching the mDNS socket when Bonjour is disconnected. This fixes the crash-at-signoff committer: Tailor Script diff -r 8004885fabbe -r b37c439dfcc0 src/protocols/bonjour/dns_sd.c --- a/src/protocols/bonjour/dns_sd.c Mon Oct 17 05:50:30 2005 +0000 +++ b/src/protocols/bonjour/dns_sd.c Mon Oct 17 06:11:02 2005 +0000 @@ -281,11 +281,10 @@ return 0; } -static gboolean -_dns_sd_handle_packets(GIOChannel *source, GIOCondition condition, gpointer data) +static void +_dns_sd_handle_packets(gpointer data, gint source, GaimInputCondition condition) { sw_discovery_read_socket(*((sw_discovery*)data)); - return TRUE; } // End private functions @@ -338,10 +337,14 @@ void bonjour_dns_sd_start(BonjourDnsSd *data) { - GIOChannel *io_channel; + GaimAccount *account; + GaimConnection *gc; gint dns_sd_socket; sw_discovery_oid session_id; + account = data->account; + gc = gaim_account_get_connection(account); + // Initilizations of the dns-sd data and session data->session = malloc(sizeof(sw_discovery)); if (sw_discovery_init(data->session) != SW_OKAY) @@ -364,9 +367,8 @@ // Get the socket that communicates with the mDNS daemon and bind it to a // callback that will handle the dns_sd packets dns_sd_socket = sw_discovery_socket(*(data->session)); - io_channel = g_io_channel_unix_new(dns_sd_socket); - // Add more for other conditions like when the conn. has been broken - g_io_add_watch(io_channel, G_IO_IN, _dns_sd_handle_packets, data->session); + gc->inpa = gaim_input_add(dns_sd_socket, GAIM_INPUT_READ, + _dns_sd_handle_packets, data->session); } /** @@ -375,7 +377,14 @@ int bonjour_dns_sd_stop(BonjourDnsSd *data) { + GaimAccount *account; + GaimConnection *gc; + sw_discovery_cancel(*(data->session), data->session_id); + account = data->account; + gc = gaim_account_get_connection(account); + gaim_input_remove(gc->inpa); + return 0; }