mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
asyn-thrdd: drop pthread_cancel
Remove use of pthread_cancel in asnyc threaded resolving. While there are system where this works, others might leak to resource leakage (memory, files, etc.). The popular nsswitch is one example where resolve code can be dragged in that is not prepared. The overall promise and mechanism of pthread_cancel() is just too brittle and the historcal design of getaddrinfo() continues to haunt us. Fixes #18532 Reported-by: Javier Blazquez Closes #18540
This commit is contained in:
parent
f7cac7cc07
commit
de3fc1d7ad
10 changed files with 16 additions and 217 deletions
19
lib/hostip.c
19
lib/hostip.c
|
|
@ -1132,10 +1132,6 @@ CURLcode Curl_resolv_timeout(struct Curl_easy *data,
|
|||
prev_alarm = alarm(curlx_sltoui(timeout/1000L));
|
||||
}
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
Curl_resolve_test_delay();
|
||||
#endif
|
||||
|
||||
#else /* !USE_ALARM_TIMEOUT */
|
||||
#ifndef CURLRES_ASYNCH
|
||||
if(timeoutms)
|
||||
|
|
@ -1639,18 +1635,3 @@ CURLcode Curl_resolver_error(struct Curl_easy *data, const char *detail)
|
|||
return result;
|
||||
}
|
||||
#endif /* USE_CURL_ASYNC */
|
||||
|
||||
#ifdef DEBUGBUILD
|
||||
#include "curlx/wait.h"
|
||||
|
||||
void Curl_resolve_test_delay(void)
|
||||
{
|
||||
const char *p = getenv("CURL_DNS_DELAY_MS");
|
||||
if(p) {
|
||||
curl_off_t l;
|
||||
if(!curlx_str_number(&p, &l, TIME_T_MAX) && l) {
|
||||
curlx_wait_ms((timediff_t)l);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue