aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-10-17 08:05:41 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-10-17 08:05:41 +0000
commit0bb20cc61184c92eb75d92d452ab8298a8281b8b (patch)
treedc0b0554f11b59ff997cc16c19ce7e417e69c400 /lib/url.c
parent433c0c895e497efcf080d0a9d9fbb6a9f84d4460 (diff)
fix the name resolve abort timeout calculation (when signals are used)
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/url.c b/lib/url.c
index 1b6f0bb7c..13670cf0b 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -3668,6 +3668,15 @@ static CURLcode CreateConnection(struct SessionHandle *data,
* Set signal handler to catch SIGALRM
* 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 HAVE_SIGACTION
@@ -3697,9 +3706,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
#ifdef HAVE_ALARM
/* alarm() makes a signal get sent when the timeout fires off, and that
will abort system calls */
- prev_alarm = alarm((unsigned int) (data->set.connecttimeout?
- data->set.connecttimeout:
- data->set.timeout));
+ prev_alarm = alarm((unsigned int) shortest);
/* 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
has been done since then until now. */