Mercurial > pidgin.yaz
changeset 11678:b37c439dfcc0
[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 <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 17 Oct 2005 06:11:02 +0000 |
parents | 8004885fabbe |
children | f05542391cd2 |
files | src/protocols/bonjour/dns_sd.c |
diffstat | 1 files changed, 16 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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; }