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:
Stefan Eissing 2025-03-22 11:22:22 +01:00 committed by Daniel Stenberg
parent ec4e2cd15d
commit f68eae250b
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 4 additions and 11 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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