mirror of
https://github.com/curl/curl.git
synced 2025-09-09 21:52:40 +03:00
conn: eliminate conn->now
it was only used in pingpong.c to check if the overall transfer has timed out and we do that with `Curl_timeleft()` in all other places. Closes #16793
This commit is contained in:
parent
ec4e2cd15d
commit
f68eae250b
|
@ -51,10 +51,10 @@
|
|||
timediff_t Curl_pp_state_timeout(struct Curl_easy *data,
|
||||
struct pingpong *pp, bool disconnecting)
|
||||
{
|
||||
struct connectdata *conn = data->conn;
|
||||
timediff_t timeout_ms; /* in milliseconds */
|
||||
timediff_t response_time = (data->set.server_response_timeout) ?
|
||||
data->set.server_response_timeout : pp->response_time;
|
||||
struct curltime now = Curl_now();
|
||||
|
||||
/* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine
|
||||
remaining time, or use pp->response because SERVER_RESPONSE_TIMEOUT is
|
||||
|
@ -63,14 +63,11 @@ timediff_t Curl_pp_state_timeout(struct Curl_easy *data,
|
|||
|
||||
/* 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_timediff(Curl_now(), pp->response); /* spent time */
|
||||
timeout_ms = response_time - Curl_timediff(now, pp->response);
|
||||
|
||||
if(data->set.timeout && !disconnecting) {
|
||||
/* if timeout is requested, find out how much remaining time we have */
|
||||
timediff_t timeout2_ms = data->set.timeout - /* timeout time */
|
||||
Curl_timediff(Curl_now(), conn->now); /* spent time */
|
||||
|
||||
/* if timeout is requested, find out how much overall remains */
|
||||
timediff_t timeout2_ms = Curl_timeleft(data, &now, FALSE);
|
||||
/* pick the lowest number */
|
||||
timeout_ms = CURLMIN(timeout_ms, timeout2_ms);
|
||||
}
|
||||
|
|
|
@ -3781,9 +3781,6 @@ CURLcode Curl_setup_conn(struct Curl_easy *data,
|
|||
return result;
|
||||
}
|
||||
|
||||
/* set start time here for timeout purposes in the connect procedure, it
|
||||
is later set again for the progress meter purpose */
|
||||
conn->now = Curl_now();
|
||||
if(!conn->bits.reuse)
|
||||
result = Curl_conn_setup(data, conn, FIRSTSOCKET, conn->dns_entry,
|
||||
CURL_CF_SSL_DEFAULT);
|
||||
|
|
|
@ -803,7 +803,6 @@ struct connectdata {
|
|||
char *options; /* options string, allocated */
|
||||
char *sasl_authzid; /* authorization identity string, allocated */
|
||||
char *oauth_bearer; /* OAUTH2 bearer, allocated */
|
||||
struct curltime now; /* "current" time */
|
||||
struct curltime created; /* creation time */
|
||||
struct curltime lastused; /* when returned to the connection poolas idle */
|
||||
curl_socket_t sock[2]; /* two sockets, the second is used for the data
|
||||
|
|
Loading…
Reference in New Issue
Block a user