- Made the pingpong timeout code properly deal with the response timeout AND

the global timeout if set. Also, as was reported in the bug report #2956437
  by Ryan Chan, the time stamp to use as basis for the per command timeout was
  not set properly in the DONE phase for FTP (and not for SMTP) so I fixed
  that just now. This was a regression compared to 7.19.7 due to the
  conversion of FTP code over to the generic pingpong concepts.

  http://curl.haxx.se/bug/view.cgi?id=2956437
This commit is contained in:
Daniel Stenberg
2010-03-02 13:26:23 +00:00
parent 8719398d05
commit 13ac29382f
5 changed files with 38 additions and 16 deletions

View File

@@ -50,23 +50,28 @@ long Curl_pp_state_timeout(struct pingpong *pp)
struct connectdata *conn = pp->conn;
struct SessionHandle *data=conn->data;
long timeout_ms; /* in milliseconds */
long timeout2_ms; /* in milliseconds */
long response_time= (data->set.server_response_timeout)?
data->set.server_response_timeout: pp->response_time;
if(data->set.server_response_timeout )
/* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine
remaining time. Also, use pp->response because SERVER_RESPONSE_TIMEOUT
is supposed to govern the response for any given server response, not
for the time from connect to the given server response. */
timeout_ms = data->set.server_response_timeout - /* timeout time */
Curl_tvdiff(Curl_tvnow(), pp->response); /* spent time */
else if(data->set.timeout)
/* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine
remaining time, or use pp->response because SERVER_RESPONSE_TIMEOUT is
supposed to govern the response for any given server response, not for
the time from connect to the given server response. */
/* Without a requested timeout, we only wait 'response_time' seconds for the
full response to arrive before we bail out */
timeout_ms = response_time -
Curl_tvdiff(Curl_tvnow(), pp->response); /* spent time */
if(data->set.timeout) {
/* if timeout is requested, find out how much remaining time we have */
timeout_ms = data->set.timeout - /* timeout time */
timeout2_ms = data->set.timeout - /* timeout time */
Curl_tvdiff(Curl_tvnow(), conn->now); /* spent time */
else
/* Without a requested timeout, we only wait 'response_time' seconds for
the full response to arrive before we bail out */
timeout_ms = pp->response_time -
Curl_tvdiff(Curl_tvnow(), pp->response); /* spent time */
/* pick the lowest number */
timeout_ms = CURLMIN(timeout_ms, timeout2_ms);
}
return timeout_ms;
}