Mercurial > pidgin
diff libgaim/protocols/simple/simple.c @ 14267:645598a4ec04
[gaim-migrate @ 16949]
Change gaim_network_listen() and gaim_network_listen_range()
to be cancelable. This doesn't actually help anything yet,
since the gaim_upnp_functions() are not yet cancelable. But
the framework is there, and the PRPLs shouldn't need any
additional changes.
Still to go:
gaim_upnp_everything()
gaim_url_fetch()
gaim_srv_resolve()
Let me know if there are others
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Mon, 21 Aug 2006 07:47:03 +0000 |
| parents | baff095b146c |
| children | 9ad313800b19 |
line wrap: on
line diff
--- a/libgaim/protocols/simple/simple.c Mon Aug 21 07:44:31 2006 +0000 +++ b/libgaim/protocols/simple/simple.c Mon Aug 21 07:47:03 2006 +0000 @@ -1506,6 +1506,8 @@ static void simple_udp_host_resolved_listen_cb(int listenfd, gpointer data) { struct simple_account_data *sip = (struct simple_account_data*) data; + sip->listen_data = NULL; + if(listenfd == -1) { gaim_connection_error(sip->gc, _("Could not create listen socket")); return; @@ -1546,8 +1548,9 @@ } /* create socket for incoming connections */ - if(!gaim_network_listen_range(5060, 5160, SOCK_DGRAM, - simple_udp_host_resolved_listen_cb, sip)) { + sip->listen_data = gaim_network_listen_range(5060, 5160, SOCK_DGRAM, + simple_udp_host_resolved_listen_cb, sip); + if (sip->listen_data == NULL) { gaim_connection_error(sip->gc, _("Could not create listen socket")); return; } @@ -1558,6 +1561,8 @@ struct simple_account_data *sip = (struct simple_account_data*) data; GaimProxyConnectData *connect_data; + sip->listen_data = NULL; + sip->listenfd = listenfd; if(sip->listenfd == -1) { gaim_connection_error(sip->gc, _("Could not create listen socket")); @@ -1616,8 +1621,9 @@ /* TCP case */ if(!sip->udp) { /* create socket for incoming connections */ - if(!gaim_network_listen_range(5060, 5160, SOCK_STREAM, - simple_tcp_connect_listen_cb, sip)) { + sip->listen_data = gaim_network_listen_range(5060, 5160, SOCK_STREAM, + simple_tcp_connect_listen_cb, sip); + if (sip->listen_data == NULL) { gaim_connection_error(sip->gc, _("Could not create listen socket")); return; } @@ -1697,6 +1703,9 @@ if (sip->query_data != NULL) gaim_dnsquery_destroy(sip->query_data); + if (sip->listen_data != NULL) + gaim_network_listen_cancel(sip->listen_data); + g_free(sip->servername); g_free(sip->username); g_free(sip->password);
