Mercurial > pidgin
comparison src/proxy.c @ 9655:00f96f4cc775
[gaim-migrate @ 10503]
some whitespace fixes for Mark
committer: Tailor Script <tailor@pidgin.im>
| author | Luke Schierer <lschiere@pidgin.im> |
|---|---|
| date | Tue, 03 Aug 2004 23:42:32 +0000 |
| parents | 5332ebbf437b |
| children | 2ea77e275b85 |
comparison
equal
deleted
inserted
replaced
| 9654:a735419f77ee | 9655:00f96f4cc775 |
|---|---|
| 265 "DNS child %d not responding. Killing it!\n", | 265 "DNS child %d not responding. Killing it!\n", |
| 266 req->dns_pid); | 266 req->dns_pid); |
| 267 kill(req->dns_pid, SIGKILL); | 267 kill(req->dns_pid, SIGKILL); |
| 268 return -1; | 268 return -1; |
| 269 } | 269 } |
| 270 | 270 |
| 271 gaim_debug(GAIM_DEBUG_INFO, "dns", | 271 gaim_debug(GAIM_DEBUG_INFO, "dns", |
| 272 "Successfully sent DNS request to child %d\n", req->dns_pid); | 272 "Successfully sent DNS request to child %d\n", req->dns_pid); |
| 273 return 0; | 273 return 0; |
| 274 } | 274 } |
| 275 | 275 |
| 301 g_queue_push_head(queued_requests, r); | 301 g_queue_push_head(queued_requests, r); |
| 302 } else { | 302 } else { |
| 303 req->inpa = gaim_input_add(req->fd_out, GAIM_INPUT_READ, host_resolved, req); | 303 req->inpa = gaim_input_add(req->fd_out, GAIM_INPUT_READ, host_resolved, req); |
| 304 g_free(r); | 304 g_free(r); |
| 305 } | 305 } |
| 306 | 306 |
| 307 } else { | 307 } else { |
| 308 req->host = NULL; | 308 req->host = NULL; |
| 309 req->callback = NULL; | 309 req->callback = NULL; |
| 310 req->data = NULL; | 310 req->data = NULL; |
| 311 free_dns_children = g_slist_append(free_dns_children, req); | 311 free_dns_children = g_slist_append(free_dns_children, req); |
| 419 | 419 |
| 420 int gaim_gethostbyname_async(const char *hostname, int port, dns_callback_t callback, gpointer data) | 420 int gaim_gethostbyname_async(const char *hostname, int port, dns_callback_t callback, gpointer data) |
| 421 { | 421 { |
| 422 pending_dns_request_t *req = NULL; | 422 pending_dns_request_t *req = NULL; |
| 423 dns_params_t dns_params; | 423 dns_params_t dns_params; |
| 424 | 424 |
| 425 char *host_temp = g_strdup(hostname); | 425 char *host_temp = g_strdup(hostname); |
| 426 strncpy(dns_params.hostname, g_strstrip(host_temp), sizeof(dns_params.hostname)-1); | 426 strncpy(dns_params.hostname, g_strstrip(host_temp), sizeof(dns_params.hostname)-1); |
| 427 g_free(host_temp); | 427 g_free(host_temp); |
| 428 dns_params.hostname[sizeof(dns_params.hostname)-1] = '\0'; | 428 dns_params.hostname[sizeof(dns_params.hostname)-1] = '\0'; |
| 429 dns_params.port = port; | 429 dns_params.port = port; |
| 430 | 430 |
| 431 /* Is there a free available child? */ | 431 /* Is there a free available child? */ |
| 432 while(free_dns_children && !req) { | 432 while(free_dns_children && !req) { |
| 467 return -1; | 467 return -1; |
| 468 } | 468 } |
| 469 | 469 |
| 470 /* We need to create a new child. */ | 470 /* We need to create a new child. */ |
| 471 req = g_new(pending_dns_request_t,1); | 471 req = g_new(pending_dns_request_t,1); |
| 472 | 472 |
| 473 cope_with_gdb_brokenness(); | 473 cope_with_gdb_brokenness(); |
| 474 | 474 |
| 475 req->dns_pid=fork(); | 475 req->dns_pid=fork(); |
| 476 if(req->dns_pid==0) { | 476 if(req->dns_pid==0) { |
| 477 const int zero = 0; | 477 const int zero = 0; |
| 478 int rc; | 478 int rc; |
| 479 | 479 |
| 528 } | 528 } |
| 529 | 529 |
| 530 #if HAVE_GETADDRINFO | 530 #if HAVE_GETADDRINFO |
| 531 g_snprintf(servname, sizeof(servname), "%d", dns_params.port); | 531 g_snprintf(servname, sizeof(servname), "%d", dns_params.port); |
| 532 memset(&hints,0,sizeof(hints)); | 532 memset(&hints,0,sizeof(hints)); |
| 533 | 533 |
| 534 /* This is only used to convert a service | 534 /* This is only used to convert a service |
| 535 * name to a port number. As we know we are | 535 * name to a port number. As we know we are |
| 536 * passing a number already, we know this | 536 * passing a number already, we know this |
| 537 * value will not be really used by the C | 537 * value will not be really used by the C |
| 538 * library. | 538 * library. |
| 937 | 937 |
| 938 if (connect(fd, addr, addrlen) < 0) { | 938 if (connect(fd, addr, addrlen) < 0) { |
| 939 if ((errno == EINPROGRESS) || (errno == EINTR)) { | 939 if ((errno == EINPROGRESS) || (errno == EINTR)) { |
| 940 gaim_debug(GAIM_DEBUG_WARNING, "http proxy", | 940 gaim_debug(GAIM_DEBUG_WARNING, "http proxy", |
| 941 "Connect would have blocked.\n"); | 941 "Connect would have blocked.\n"); |
| 942 | 942 |
| 943 if (phb->port != 80) { | 943 if (phb->port != 80) { |
| 944 /* we need to do CONNECT first */ | 944 /* we need to do CONNECT first */ |
| 945 phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, | 945 phb->inpa = gaim_input_add(fd, GAIM_INPUT_WRITE, |
| 946 http_canwrite, phb); | 946 http_canwrite, phb); |
| 947 } else { | 947 } else { |
