Mercurial > pidgin.yaz
changeset 17779:a62a695ccfb5
Improve Bonjour error handling when there are errors "connecting".
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Wed, 06 Jun 2007 03:22:06 +0000 |
parents | eae7a411e3a1 |
children | 496d007a8912 |
files | libpurple/protocols/bonjour/bonjour.c libpurple/protocols/bonjour/jabber.c |
diffstat | 2 files changed, 8 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/bonjour.c Wed Jun 06 03:21:04 2007 +0000 +++ b/libpurple/protocols/bonjour/bonjour.c Wed Jun 06 03:22:06 2007 +0000 @@ -94,14 +94,13 @@ bonjour_login(PurpleAccount *account) { PurpleConnection *gc = purple_account_get_connection(account); - PurpleGroup *bonjour_group = NULL; - BonjourData *bd = NULL; + PurpleGroup *bonjour_group; + BonjourData *bd; PurpleStatus *status; PurplePresence *presence; gc->flags |= PURPLE_CONNECTION_HTML; - gc->proto_data = g_new0(BonjourData, 1); - bd = gc->proto_data; + gc->proto_data = bd = g_new0(BonjourData, 1); /* Start waiting for jabber connections (iChat style) */ bd->jabber_data = g_new(BonjourJabber, 1); @@ -111,10 +110,6 @@ if (bonjour_jabber_start(bd->jabber_data) == -1) { /* Send a message about the connection error */ purple_connection_error(gc, _("Unable to listen for incoming IM connections\n")); - - /* Free the data */ - g_free(bd->jabber_data); - bd->jabber_data = NULL; return; } @@ -155,7 +150,7 @@ bonjour_close(PurpleConnection *connection) { PurpleGroup *bonjour_group; - BonjourData *bd = (BonjourData*)connection->proto_data; + BonjourData *bd = connection->proto_data; /* Stop looking for buddies in the LAN */ if (bd->dns_sd_data != NULL)
--- a/libpurple/protocols/bonjour/jabber.c Wed Jun 06 03:21:04 2007 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Wed Jun 06 03:22:06 2007 +0000 @@ -668,8 +668,10 @@ GSList *l; /* Close the server socket and remove all the watcher */ - close(data->socket); - purple_input_remove(data->watcher_id); + if (data->socket >= 0) + close(data->socket); + if (data->watcher_id > 0) + purple_input_remove(data->watcher_id); /* Close all the sockets and remove all the watchers after sending end streams */ if (data->account->gc != NULL)