Mercurial > pidgin
comparison libpurple/stun.c @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | 804239d704ff |
children |
comparison
equal
deleted
inserted
replaced
32818:01ff09d4a463 | 32819:2c6510167895 |
---|---|
172 struct stun_header *hdr; | 172 struct stun_header *hdr; |
173 struct ifconf ifc; | 173 struct ifconf ifc; |
174 struct ifreq *ifr; | 174 struct ifreq *ifr; |
175 struct sockaddr_in *sinptr; | 175 struct sockaddr_in *sinptr; |
176 | 176 |
177 memset(&in, 0, sizeof(in)); | |
178 | |
177 len = recv(source, buffer, sizeof(buffer) - 1, 0); | 179 len = recv(source, buffer, sizeof(buffer) - 1, 0); |
178 if (!len) { | 180 if (!len) { |
179 purple_debug_warning("stun", "unable to read stun response\n"); | 181 purple_debug_warning("stun", "unable to read stun response\n"); |
180 return; | 182 return; |
181 } | 183 } |
336 nattype.lookup_time = time(NULL); | 338 nattype.lookup_time = time(NULL); |
337 do_callbacks(); | 339 do_callbacks(); |
338 return; | 340 return; |
339 } | 341 } |
340 | 342 |
341 if (!purple_network_listen_range(12108, 12208, SOCK_DGRAM, hbn_listen_cb, hosts)) { | 343 if (!purple_network_listen_range(12108, 12208, AF_UNSPEC, SOCK_DGRAM, TRUE, hbn_listen_cb, hosts)) { |
342 while (hosts) { | 344 while (hosts) { |
343 hosts = g_slist_delete_link(hosts, hosts); | 345 hosts = g_slist_delete_link(hosts, hosts); |
344 g_free(hosts->data); | 346 g_free(hosts->data); |
345 hosts = g_slist_delete_link(hosts, hosts); | 347 hosts = g_slist_delete_link(hosts, hosts); |
346 } | 348 } |
363 port = resp[0].port; | 365 port = resp[0].port; |
364 } | 366 } |
365 purple_debug_info("stun", "got %d SRV responses, server: %s, port: %d\n", | 367 purple_debug_info("stun", "got %d SRV responses, server: %s, port: %d\n", |
366 results, servername, port); | 368 results, servername, port); |
367 | 369 |
368 purple_dnsquery_a_account(NULL, servername, port, hbn_cb, NULL); | 370 purple_dnsquery_a(NULL, servername, port, hbn_cb, NULL); |
369 g_free(resp); | 371 g_free(resp); |
370 } | 372 } |
371 | 373 |
372 static gboolean call_callback(gpointer data) { | 374 static gboolean call_callback(gpointer data) { |
373 StunCallback cb = data; | 375 StunCallback cb = data; |
422 nattype.publicip[0] = '\0'; | 424 nattype.publicip[0] = '\0'; |
423 g_free(nattype.servername); | 425 g_free(nattype.servername); |
424 nattype.servername = g_strdup(servername); | 426 nattype.servername = g_strdup(servername); |
425 | 427 |
426 callbacks = g_slist_append(callbacks, cb); | 428 callbacks = g_slist_append(callbacks, cb); |
427 purple_srv_resolve_account(NULL, "stun", "udp", servername, do_test1, | 429 purple_srv_resolve(NULL, "stun", "udp", servername, do_test1, |
428 (gpointer) servername); | 430 (gpointer) servername); |
429 | 431 |
430 return &nattype; | 432 return &nattype; |
431 } | 433 } |
432 | 434 |