- Michael Wallner provided a patch that adds support for CURLOPT_TIMEOUT_MS

and CURLOPT_CONNECTTIMEOUT_MS that, as their names should hint, do the
  timeouts with millisecond resolution instead. The only restriction to that
  is the alarm() (sometimes) used to abort name resolves as that uses full
  seconds. I fixed the FTP response timeout part of the patch.

  Internally we now count and keep the timeouts in milliseconds but it also
  means we multiply set timeouts with 1000. The effect of this is that no
  timeout can be set to more than 2^31 milliseconds (on 32 bit systems), which
  equals 24.86 days.  We probably couldn't before either since the code did
  *1000 on the timeout values on several places already.
This commit is contained in:
Daniel Stenberg
2007-02-05 22:51:32 +00:00
parent 0fc51ac5a6
commit 91386937ff
17 changed files with 98 additions and 62 deletions

View File

@@ -1459,17 +1459,17 @@ Curl_ossl_connect_step2(struct connectdata *conn,
if(data->set.timeout && data->set.connecttimeout) {
/* get the most strict timeout of the ones converted to milliseconds */
if(data->set.timeout<data->set.connecttimeout)
*timeout_ms = data->set.timeout*1000;
*timeout_ms = data->set.timeout;
else
*timeout_ms = data->set.connecttimeout*1000;
*timeout_ms = data->set.connecttimeout;
}
else if(data->set.timeout)
*timeout_ms = data->set.timeout*1000;
*timeout_ms = data->set.timeout;
else if(data->set.connecttimeout)
*timeout_ms = data->set.connecttimeout*1000;
*timeout_ms = data->set.connecttimeout;
else
/* no particular time-out has been set */
*timeout_ms= DEFAULT_CONNECT_TIMEOUT;
*timeout_ms = DEFAULT_CONNECT_TIMEOUT;
/* Evaluate in milliseconds how much time that has passed */
has_passed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle);