aboutsummaryrefslogtreecommitdiff
path: root/lib/url.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/url.c
parent016c6a6abb525ffb9431a00a4eda6b70683f838e (diff)
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/url.c')
-rw-r--r--lib/url.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/url.c b/lib/url.c
index 76c09c72a..594160898 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -3459,8 +3459,8 @@ Curl_oldest_idle_connection(struct Curl_easy *data)
struct curl_hash_iterator iter;
struct curl_llist_element *curr;
struct curl_hash_element *he;
- time_t highscore =- 1;
- time_t score;
+ timediff_t highscore =- 1;
+ timediff_t score;
struct curltime now;
struct connectdata *conn_candidate = NULL;
struct connectbundle *bundle;
@@ -3481,7 +3481,7 @@ Curl_oldest_idle_connection(struct Curl_easy *data)
if(!conn->inuse) {
/* Set higher score for the age passed since the connection was used */
- score = Curl_tvdiff(now, conn->now);
+ score = Curl_timediff(now, conn->now);
if(score > highscore) {
highscore = score;
@@ -3522,8 +3522,8 @@ find_oldest_idle_connection_in_bundle(struct Curl_easy *data,
struct connectbundle *bundle)
{
struct curl_llist_element *curr;
- time_t highscore = -1;
- time_t score;
+ timediff_t highscore = -1;
+ timediff_t score;
struct curltime now;
struct connectdata *conn_candidate = NULL;
struct connectdata *conn;
@@ -3538,7 +3538,7 @@ find_oldest_idle_connection_in_bundle(struct Curl_easy *data,
if(!conn->inuse) {
/* Set higher score for the age passed since the connection was used */
- score = Curl_tvdiff(now, conn->now);
+ score = Curl_timediff(now, conn->now);
if(score > highscore) {
highscore = score;
@@ -3613,7 +3613,7 @@ static int call_disconnect_if_dead(struct connectdata *conn,
static void prune_dead_connections(struct Curl_easy *data)
{
struct curltime now = Curl_tvnow();
- time_t elapsed = Curl_tvdiff(now, data->state.conn_cache->last_cleanup);
+ time_t elapsed = Curl_timediff(now, data->state.conn_cache->last_cleanup);
if(elapsed >= 1000L) {
Curl_conncache_foreach(data->state.conn_cache, data,