Mercurial > pidgin.yaz
comparison src/upnp.c @ 13200:33bef17125c2
[gaim-migrate @ 15563]
This is the soon-to-be-infamous nonblocking network activity patch that I've been working on. Feel free to yell at me if this makes you unhappy.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Thu, 09 Feb 2006 04:17:56 +0000 |
parents | ef1b5208bda9 |
children | 095fd5936962 |
comparison
equal
deleted
inserted
replaced
13199:d8f238864c88 | 13200:33bef17125c2 |
---|---|
406 | 406 |
407 g_free(descriptionXMLAddress); | 407 g_free(descriptionXMLAddress); |
408 | 408 |
409 dd->full_url = g_strdup_printf("http://%s:%d", | 409 dd->full_url = g_strdup_printf("http://%s:%d", |
410 descriptionAddress, port); | 410 descriptionAddress, port); |
411 g_free(descriptionAddress); | |
411 | 412 |
412 /* Remove the timeout because everything it is waiting for has | 413 /* Remove the timeout because everything it is waiting for has |
413 * successfully completed */ | 414 * successfully completed */ |
414 gaim_timeout_remove(dd->tima); | 415 gaim_timeout_remove(dd->tima); |
415 dd->tima = 0; | 416 dd->tima = 0; |
416 | 417 |
417 gaim_url_fetch_request(descriptionURL, TRUE, NULL, TRUE, httpRequest, | 418 gaim_url_fetch_request(descriptionURL, TRUE, NULL, TRUE, httpRequest, |
418 TRUE, upnp_parse_description_cb, dd); | 419 TRUE, upnp_parse_description_cb, dd); |
419 | 420 |
420 g_free(descriptionAddress); | |
421 g_free(httpRequest); | 421 g_free(httpRequest); |
422 | 422 |
423 } | 423 } |
424 | 424 |
425 static void | 425 static void |
541 | 541 |
542 /* because we are sending over UDP, if there is a failure | 542 /* because we are sending over UDP, if there is a failure |
543 we should retry the send NUM_UDP_ATTEMPTS times. Also, | 543 we should retry the send NUM_UDP_ATTEMPTS times. Also, |
544 try different requests for WANIPConnection and WANPPPConnection*/ | 544 try different requests for WANIPConnection and WANPPPConnection*/ |
545 for(; dd->retry_count < NUM_UDP_ATTEMPTS; dd->retry_count++) { | 545 for(; dd->retry_count < NUM_UDP_ATTEMPTS; dd->retry_count++) { |
546 sentSuccess = TRUE; | 546 sentSuccess = FALSE; |
547 | 547 |
548 if((dd->retry_count % 2) == 0) { | 548 if((dd->retry_count % 2) == 0) { |
549 strncpy(dd->service_type, WAN_IP_CONN_SERVICE, sizeof(dd->service_type)); | 549 strncpy(dd->service_type, WAN_IP_CONN_SERVICE, sizeof(dd->service_type)); |
550 } else { | 550 } else { |
551 strncpy(dd->service_type, WAN_PPP_CONN_SERVICE, sizeof(dd->service_type)); | 551 strncpy(dd->service_type, WAN_PPP_CONN_SERVICE, sizeof(dd->service_type)); |
561 sizeof(struct sockaddr_in) | 561 sizeof(struct sockaddr_in) |
562 ) == totalSize) { | 562 ) == totalSize) { |
563 sentSuccess = TRUE; | 563 sentSuccess = TRUE; |
564 break; | 564 break; |
565 } | 565 } |
566 } while (errno == EINTR); | 566 } while (errno == EINTR || errno == EAGAIN); |
567 | 567 |
568 g_free(sendMessage); | 568 g_free(sendMessage); |
569 | 569 |
570 if(sentSuccess) { | 570 if(sentSuccess) { |
571 dd->tima = gaim_timeout_add(DISCOVERY_TIMEOUT, | 571 dd->tima = gaim_timeout_add(DISCOVERY_TIMEOUT, |