mirror of
https://github.com/curl/curl.git
synced 2026-07-31 15:48:04 +03:00
select: return error from "lethal" poll/select errors
Adds two new error codes: CURLE_UNRECOVERABLE_POLL and CURLM_UNRECOVERABLE_POLL one each for the easy and the multi interfaces. Reported-by: Harry Sintonen Fixes #8921 Closes #8961
This commit is contained in:
parent
7007324a6a
commit
5912da253b
10 changed files with 37 additions and 8 deletions
|
|
@ -306,7 +306,7 @@ int Curl_resolver_getsock(struct Curl_easy *data,
|
|||
* 2) wait for the timeout period to check for action on ares' sockets.
|
||||
* 3) tell ares to act on all the sockets marked as "with action"
|
||||
*
|
||||
* return number of sockets it worked on
|
||||
* return number of sockets it worked on, or -1 on error
|
||||
*/
|
||||
|
||||
static int waitperform(struct Curl_easy *data, timediff_t timeout_ms)
|
||||
|
|
@ -338,8 +338,11 @@ static int waitperform(struct Curl_easy *data, timediff_t timeout_ms)
|
|||
break;
|
||||
}
|
||||
|
||||
if(num)
|
||||
if(num) {
|
||||
nfds = Curl_poll(pfd, num, timeout_ms);
|
||||
if(nfds < 0)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
nfds = 0;
|
||||
|
||||
|
|
@ -376,7 +379,8 @@ CURLcode Curl_resolver_is_resolved(struct Curl_easy *data,
|
|||
DEBUGASSERT(dns);
|
||||
*dns = NULL;
|
||||
|
||||
waitperform(data, 0);
|
||||
if(waitperform(data, 0) < 0)
|
||||
return CURLE_UNRECOVERABLE_POLL;
|
||||
|
||||
#ifndef HAVE_CARES_GETADDRINFO
|
||||
/* Now that we've checked for any last minute results above, see if there are
|
||||
|
|
@ -475,7 +479,8 @@ CURLcode Curl_resolver_wait_resolv(struct Curl_easy *data,
|
|||
else
|
||||
timeout_ms = 1000;
|
||||
|
||||
waitperform(data, timeout_ms);
|
||||
if(waitperform(data, timeout_ms) < 0)
|
||||
return CURLE_UNRECOVERABLE_POLL;
|
||||
result = Curl_resolver_is_resolved(data, entry);
|
||||
|
||||
if(result || data->state.async.done)
|
||||
|
|
|
|||
|
|
@ -549,6 +549,8 @@ static CURLcode wait_or_timeout(struct Curl_multi *multi, struct events *ev)
|
|||
|
||||
/* wait for activity or timeout */
|
||||
pollrc = Curl_poll(fds, numfds, ev->ms);
|
||||
if(pollrc < 0)
|
||||
return CURLE_UNRECOVERABLE_POLL;
|
||||
|
||||
after = Curl_now();
|
||||
|
||||
|
|
|
|||
|
|
@ -1312,6 +1312,8 @@ static CURLMcode multi_wait(struct Curl_multi *multi,
|
|||
#else
|
||||
pollrc = Curl_poll(ufds, nfds, timeout_ms); /* wait... */
|
||||
#endif
|
||||
if(pollrc < 0)
|
||||
return CURLM_UNRECOVERABLE_POLL;
|
||||
|
||||
if(pollrc > 0) {
|
||||
retcode = pollrc;
|
||||
|
|
|
|||
|
|
@ -352,8 +352,12 @@ int Curl_poll(struct pollfd ufds[], unsigned int nfds, timediff_t timeout_ms)
|
|||
value).
|
||||
*/
|
||||
r = our_select(maxfd, &fds_read, &fds_write, &fds_err, timeout_ms);
|
||||
if(r <= 0)
|
||||
if(r <= 0) {
|
||||
if((r == -1) && (SOCKERRNO == EINTR))
|
||||
/* make EINTR from select or poll not a "lethal" error */
|
||||
r = 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
r = 0;
|
||||
for(i = 0; i < nfds; i++) {
|
||||
|
|
|
|||
|
|
@ -317,6 +317,9 @@ curl_easy_strerror(CURLcode error)
|
|||
case CURLE_SSL_CLIENTCERT:
|
||||
return "SSL Client Certificate required";
|
||||
|
||||
case CURLE_UNRECOVERABLE_POLL:
|
||||
return "Unrecoverable error in select/poll";
|
||||
|
||||
/* error codes not used by current libcurl */
|
||||
case CURLE_OBSOLETE20:
|
||||
case CURLE_OBSOLETE24:
|
||||
|
|
@ -400,6 +403,9 @@ curl_multi_strerror(CURLMcode error)
|
|||
case CURLM_ABORTED_BY_CALLBACK:
|
||||
return "Operation was aborted by an application callback";
|
||||
|
||||
case CURLM_UNRECOVERABLE_POLL:
|
||||
return "Unrecoverable error in select/poll";
|
||||
|
||||
case CURLM_LAST:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue