- 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:
@@ -1547,13 +1547,13 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||
return result;
|
||||
|
||||
if (data->set.timeout &&
|
||||
((Curl_tvdiff(k->now, k->start)/1000) >= data->set.timeout)) {
|
||||
(Curl_tvdiff(k->now, k->start) >= data->set.timeout)) {
|
||||
if (k->size != -1) {
|
||||
failf(data, "Operation timed out after %d seconds with %"
|
||||
failf(data, "Operation timed out after %d milliseconds with %"
|
||||
FORMAT_OFF_T " out of %" FORMAT_OFF_T " bytes received",
|
||||
data->set.timeout, k->bytecount, k->size);
|
||||
} else {
|
||||
failf(data, "Operation timed out after %d seconds with %"
|
||||
failf(data, "Operation timed out after %d milliseconds with %"
|
||||
FORMAT_OFF_T " bytes received",
|
||||
data->set.timeout, k->bytecount);
|
||||
}
|
||||
|
Reference in New Issue
Block a user