summaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-10-23 12:05:49 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-10-25 09:54:37 +0200
commitb9d25f9a6b3ca791385b80a6a3c3fa5ae113e1e0 (patch)
treead56d8b7a703e96e9de0ef07bacab079b7169904 /lib/connect.c
parent016c6a6abb525ffb9431a00a4eda6b70683f838e (diff)
downloadcurl-b9d25f9a6b3ca791385b80a6a3c3fa5ae113e1e0.tar.gz
timediff: return timediff_t from the time diff functions
... to cater for systems with unsigned time_t variables. - Renamed the functions to curlx_timediff and Curl_timediff_us. - Added overflow protection for both of them in either direction for both 32 bit and 64 bit time_ts - Reprefixed the curlx_time functions to use Curl_* Reported-by: Peter Piekarski Fixes #2004 Closes #2005
Diffstat (limited to 'lib/connect.c')
-rwxr-xr-xlib/connect.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/connect.c b/lib/connect.c
index b7d10af55..7bf82d14a 100755
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -225,10 +225,10 @@ time_t Curl_timeleft(struct Curl_easy *data,
/* subtract elapsed time */
if(duringconnect)
/* since this most recent connect started */
- timeout_ms -= Curl_tvdiff(*nowp, data->progress.t_startsingle);
+ timeout_ms -= Curl_timediff(*nowp, data->progress.t_startsingle);
else
/* since the entire operation started */
- timeout_ms -= Curl_tvdiff(*nowp, data->progress.t_startop);
+ timeout_ms -= Curl_timediff(*nowp, data->progress.t_startop);
if(!timeout_ms)
/* avoid returning 0 as that means no timeout! */
return -1;
@@ -765,7 +765,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
if(rc == 0) { /* no connection yet */
error = 0;
- if(curlx_tvdiff(now, conn->connecttime) >= conn->timeoutms_per_addr) {
+ if(Curl_timediff(now, conn->connecttime) >= conn->timeoutms_per_addr) {
infof(data, "After %ldms connect time, move on!\n",
conn->timeoutms_per_addr);
error = ETIMEDOUT;
@@ -773,7 +773,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
/* should we try another protocol family? */
if(i == 0 && conn->tempaddr[1] == NULL &&
- curlx_tvdiff(now, conn->connecttime) >= HAPPY_EYEBALLS_TIMEOUT) {
+ Curl_timediff(now, conn->connecttime) >= HAPPY_EYEBALLS_TIMEOUT) {
trynextip(conn, sockindex, 1);
}
}