Mercurial > pidgin
changeset 23567:a9db0aec7e59
Fix running several Bonjour instances on the same machine.
The server socket had SO_REUSEADDR set, which was causing all the instances to
share the same port (and therefore it was indeterminate who would actually get
the incoming connection).
Fixes #6231
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Sat, 19 Jul 2008 00:18:18 +0000 |
parents | 0fd0c52364a2 |
children | c3506ae277f6 |
files | libpurple/protocols/bonjour/jabber.c libpurple/win32/libc_interface.c |
diffstat | 2 files changed, 6 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/bonjour/jabber.c Fri Jul 18 21:10:23 2008 +0000 +++ b/libpurple/protocols/bonjour/jabber.c Sat Jul 19 00:18:18 2008 +0000 @@ -672,7 +672,6 @@ bonjour_jabber_start(BonjourJabber *jdata) { struct sockaddr_in my_addr; - int yes = 1; int i; gboolean bind_successful; @@ -686,16 +685,6 @@ return -1; } - /* Make the socket reusable */ - if (setsockopt(jdata->socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) != 0) - { - purple_debug_error("bonjour", "Error setting socket options: %s\n", g_strerror(errno)); - purple_connection_error_reason (jdata->account->gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, - _("Error setting socket options")); - return -1; - } - memset(&my_addr, 0, sizeof(struct sockaddr_in)); my_addr.sin_family = AF_INET; @@ -709,6 +698,8 @@ bind_successful = TRUE; break; } + + purple_debug_info("bonjour", "Unable to bind to port %u.(%s)\n", jdata->port, g_strerror(errno)); jdata->port++; }
--- a/libpurple/win32/libc_interface.c Fri Jul 18 21:10:23 2008 +0000 +++ b/libpurple/win32/libc_interface.c Sat Jul 19 00:18:18 2008 +0000 @@ -327,9 +327,12 @@ case WSAETIMEDOUT: /* 10060 */ g_snprintf(errbuf, sizeof(errbuf), _("Connection timed out.")); break; - case WSAECONNREFUSED: /*10061 */ + case WSAECONNREFUSED: /* 10061 */ g_snprintf(errbuf, sizeof(errbuf), _("Connection refused.")); break; + case WSAEADDRINUSE: /* 10048 */ + g_snprintf(errbuf, sizeof(errbuf), _("Address already in use.")); + break; default: g_snprintf(errbuf, sizeof(errbuf), "Windows socket error #%d", errornum); }