mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
sws: handle EINTR when calling select()
Closes https://github.com/curl/curl/pull/2808
This commit is contained in:
parent
ea6f57696c
commit
3db628360c
@ -1536,17 +1536,17 @@ static void http_connect(curl_socket_t *infdp,
|
|||||||
if(got_exit_signal)
|
if(got_exit_signal)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
do {
|
||||||
rc = select((int)maxfd + 1, &input, &output, NULL, &timeout);
|
rc = select((int)maxfd + 1, &input, &output, NULL, &timeout);
|
||||||
|
} while(rc < 0 && errno == EINTR && !got_exit_signal);
|
||||||
if(rc > 0) {
|
|
||||||
/* socket action */
|
|
||||||
bool tcp_fin_wr;
|
|
||||||
timeout_count = 0;
|
|
||||||
|
|
||||||
if(got_exit_signal)
|
if(got_exit_signal)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
tcp_fin_wr = FALSE;
|
if(rc > 0) {
|
||||||
|
/* socket action */
|
||||||
|
bool tcp_fin_wr = FALSE;
|
||||||
|
timeout_count = 0;
|
||||||
|
|
||||||
/* ---------------------------------------------------------- */
|
/* ---------------------------------------------------------- */
|
||||||
|
|
||||||
@ -2289,7 +2289,13 @@ int main(int argc, char *argv[])
|
|||||||
if(got_exit_signal)
|
if(got_exit_signal)
|
||||||
goto sws_cleanup;
|
goto sws_cleanup;
|
||||||
|
|
||||||
|
do {
|
||||||
rc = select((int)maxfd + 1, &input, &output, NULL, &timeout);
|
rc = select((int)maxfd + 1, &input, &output, NULL, &timeout);
|
||||||
|
} while(rc < 0 && errno == EINTR && !got_exit_signal);
|
||||||
|
|
||||||
|
if(got_exit_signal)
|
||||||
|
goto sws_cleanup;
|
||||||
|
|
||||||
if(rc < 0) {
|
if(rc < 0) {
|
||||||
error = SOCKERRNO;
|
error = SOCKERRNO;
|
||||||
logmsg("select() failed with error: (%d) %s",
|
logmsg("select() failed with error: (%d) %s",
|
||||||
@ -2297,9 +2303,6 @@ int main(int argc, char *argv[])
|
|||||||
goto sws_cleanup;
|
goto sws_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(got_exit_signal)
|
|
||||||
goto sws_cleanup;
|
|
||||||
|
|
||||||
if(rc == 0) {
|
if(rc == 0) {
|
||||||
/* Timed out - try again */
|
/* Timed out - try again */
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user