mirror of
https://github.com/moparisthebest/curl
synced 2025-03-01 09:51:46 -05:00
fix the name resolve abort timeout calculation (when signals are used)
This commit is contained in:
parent
433c0c895e
commit
0bb20cc611
13
lib/url.c
13
lib/url.c
@ -3668,6 +3668,15 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
* Set signal handler to catch SIGALRM
|
* Set signal handler to catch SIGALRM
|
||||||
* Store the old value to be able to set it back later!
|
* Store the old value to be able to set it back later!
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
|
long shortest = data->set.timeout; /* default to this timeout value */
|
||||||
|
|
||||||
|
if(shortest && data->set.connecttimeout &&
|
||||||
|
(data->set.connecttimeout < shortest))
|
||||||
|
/* if both are set, pick the shortest */
|
||||||
|
shortest = data->set.connecttimeout;
|
||||||
|
else if(!shortest)
|
||||||
|
/* if timeout is not set, use the connect timeout */
|
||||||
|
shortest = data->set.connecttimeout
|
||||||
|
|
||||||
#ifdef SIGALRM
|
#ifdef SIGALRM
|
||||||
#ifdef HAVE_SIGACTION
|
#ifdef HAVE_SIGACTION
|
||||||
@ -3697,9 +3706,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
#ifdef HAVE_ALARM
|
#ifdef HAVE_ALARM
|
||||||
/* alarm() makes a signal get sent when the timeout fires off, and that
|
/* alarm() makes a signal get sent when the timeout fires off, and that
|
||||||
will abort system calls */
|
will abort system calls */
|
||||||
prev_alarm = alarm((unsigned int) (data->set.connecttimeout?
|
prev_alarm = alarm((unsigned int) shortest);
|
||||||
data->set.connecttimeout:
|
|
||||||
data->set.timeout));
|
|
||||||
/* We can expect the conn->created time to be "now", as that was just
|
/* We can expect the conn->created time to be "now", as that was just
|
||||||
recently set in the beginning of this function and nothing slow
|
recently set in the beginning of this function and nothing slow
|
||||||
has been done since then until now. */
|
has been done since then until now. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user