[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 237/254: expire: remove Curl_expire_latest()
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 237/254: expire: remove Curl_expire_latest() |
Date: |
Sat, 17 Jun 2017 16:54:29 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.54.1
in repository gnurl.
commit 7fffe97b787b962fc0afcd5737cec411f2bc0023
Author: Daniel Stenberg <address@hidden>
AuthorDate: Thu Jun 8 08:34:32 2017 +0200
expire: remove Curl_expire_latest()
With the introduction of expire IDs and the fact that existing timers
can be removed now and thus never expire, the concept with adding a
"latest" timer is not working anymore as it risks to not expire at all.
So, to be certain the timers actually are in line and will expire, the
plain Curl_expire() needs to be used. The _latest() function was added
as a sort of shortcut in the past that's quite simply not necessary
anymore.
Follow-up to 31b39c40cf90
Reported-by: Paul Harris
Closes #1555
---
lib/connect.c | 2 +-
lib/multi.c | 56 ++++++--------------------------------------------------
lib/multiif.h | 1 -
lib/speedcheck.c | 2 +-
4 files changed, 8 insertions(+), 53 deletions(-)
diff --git a/lib/connect.c b/lib/connect.c
index de84daa4f..d4fd52b99 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -1070,7 +1070,7 @@ static CURLcode singleipconnect(struct connectdata *conn,
conn->connecttime = Curl_tvnow();
if(conn->num_addr > 1)
- Curl_expire_latest(data, conn->timeoutms_per_addr, EXPIRE_DNS_PER_NAME);
+ Curl_expire(data, conn->timeoutms_per_addr, EXPIRE_DNS_PER_NAME);
/* Connect TCP sockets, bind UDP */
if(!isconnected && (conn->socktype == SOCK_STREAM)) {
diff --git a/lib/multi.c b/lib/multi.c
index 4b2872743..c3a0d122c 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -1840,9 +1840,9 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
if(send_timeout_ms <= 0 && recv_timeout_ms <= 0)
multistate(data, CURLM_STATE_PERFORM);
else if(send_timeout_ms >= recv_timeout_ms)
- Curl_expire_latest(data, send_timeout_ms, EXPIRE_TOOFAST);
+ Curl_expire(data, send_timeout_ms, EXPIRE_TOOFAST);
else
- Curl_expire_latest(data, recv_timeout_ms, EXPIRE_TOOFAST);
+ Curl_expire(data, recv_timeout_ms, EXPIRE_TOOFAST);
}
break;
@@ -1873,9 +1873,9 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
if(send_timeout_ms > 0 || recv_timeout_ms > 0) {
multistate(data, CURLM_STATE_TOOFAST);
if(send_timeout_ms >= recv_timeout_ms)
- Curl_expire_latest(data, send_timeout_ms, EXPIRE_TOOFAST);
+ Curl_expire(data, send_timeout_ms, EXPIRE_TOOFAST);
else
- Curl_expire_latest(data, recv_timeout_ms, EXPIRE_TOOFAST);
+ Curl_expire(data, recv_timeout_ms, EXPIRE_TOOFAST);
break;
}
@@ -1936,8 +1936,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
/* expire the new receiving pipeline head */
if(data->easy_conn->recv_pipe.head)
- Curl_expire_latest(data->easy_conn->recv_pipe.head->ptr, 0,
- EXPIRE_RUN_NOW);
+ Curl_expire(data->easy_conn->recv_pipe.head->ptr, 0, EXPIRE_RUN_NOW);
/* Check if we can move pending requests to send pipe */
Curl_multi_process_pending_handles(multi);
@@ -2977,49 +2976,6 @@ void Curl_expire(struct Curl_easy *data, time_t milli,
expire_id id)
}
/*
- * Curl_expire_latest()
- *
- * This is like Curl_expire() but will only add a timeout node to the list of
- * timers if there is no timeout that will expire before the given time.
- *
- * Use this function if the code logic risks calling this function many times
- * or if there's no particular conditional wait in the code for this specific
- * time-out period to expire.
- *
- */
-void Curl_expire_latest(struct Curl_easy *data, time_t milli, expire_id id)
-{
- struct timeval *expire = &data->state.expiretime;
-
- struct timeval set;
-
- set = Curl_tvnow();
- set.tv_sec += (long)(milli / 1000);
- set.tv_usec += (long)(milli % 1000) * 1000;
-
- if(set.tv_usec >= 1000000) {
- set.tv_sec++;
- set.tv_usec -= 1000000;
- }
-
- if(expire->tv_sec || expire->tv_usec) {
- /* This means that the struct is added as a node in the splay tree.
- Compare if the new time is earlier, and only remove-old/add-new if it
- is. */
- time_t diff = curlx_tvdiff(set, *expire);
- if((diff > 0) && (diff < milli)) {
- /* if the new expire time is later than the top time, skip it, but not
- if the diff is larger than the new offset since then the previous
- time is already expired! */
- return;
- }
- }
-
- /* Just add the timeout like normal */
- Curl_expire(data, milli, id);
-}
-
-/*
* Curl_expire_done()
*
* Removes the expire timer. Marks it as done.
@@ -3134,7 +3090,7 @@ void Curl_multi_process_pending_handles(struct Curl_multi
*multi)
Curl_llist_remove(&multi->pending, e, NULL);
/* Make sure that the handle will be processed soonish. */
- Curl_expire_latest(data, 0, EXPIRE_RUN_NOW);
+ Curl_expire(data, 0, EXPIRE_RUN_NOW);
}
e = next; /* operate on next handle */
diff --git a/lib/multiif.h b/lib/multiif.h
index a833e23e0..a877571a0 100644
--- a/lib/multiif.h
+++ b/lib/multiif.h
@@ -28,7 +28,6 @@
void Curl_expire(struct Curl_easy *data, time_t milli, expire_id);
void Curl_expire_clear(struct Curl_easy *data);
-void Curl_expire_latest(struct Curl_easy *data, time_t milli, expire_id);
void Curl_expire_done(struct Curl_easy *data, expire_id id);
bool Curl_pipeline_wanted(const struct Curl_multi* multi, int bits);
void Curl_multi_handlePipeBreak(struct Curl_easy *data);
diff --git a/lib/speedcheck.c b/lib/speedcheck.c
index 694d7f695..8addedde5 100644
--- a/lib/speedcheck.c
+++ b/lib/speedcheck.c
@@ -67,7 +67,7 @@ CURLcode Curl_speedcheck(struct Curl_easy *data,
if(data->set.low_speed_limit)
/* if low speed limit is enabled, set the expire timer to make this
connection's speed get checked again in a second */
- Curl_expire_latest(data, 1000, EXPIRE_SPEEDCHECK);
+ Curl_expire(data, 1000, EXPIRE_SPEEDCHECK);
return CURLE_OK;
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 162/254: url: fix declaration of 'pipe' shadows a global declaration, (continued)
- [GNUnet-SVN] [gnurl] 162/254: url: fix declaration of 'pipe' shadows a global declaration, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 214/254: updatemanpages.pl: error out on too old git version, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 148/254: mkhelp.pl: do not add current time into curl binary, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 164/254: LDAP: using ldap_bind_s on Windows with methods (#878), gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 234/254: metalink: remove unused printf() argument, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 153/254: tests: stabilize test 1034, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 238/254: asyn-ares: s/Curl_expire_latest/Curl_expire, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 235/254: file: make speedcheck use current time for checks, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 156/254: cmake: add CURL_CA_BUNDLE/CURL_CA_FALLBACK/CURL_CA_PATH options, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 183/254: docs: clarify NO_PROXY further, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 237/254: expire: remove Curl_expire_latest(),
gnunet <=
- [GNUnet-SVN] [gnurl] 200/254: typecheck-gcc.h: separate getinfo slist checks from other pointers, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 218/254: libtest: fix int-in-bool-context warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 244/254: RELEASE-PROCEDURE: updated future release dates, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 249/254: urlglob: fix division by zero, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 175/254: opts: more examples added in option man pages, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 251/254: libressl: OCSP and intermediate certs workaround no longer needed, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 80/254: typecheck-gcc: add support for CURLINFO_SOCKET, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 104/254: tftp: silence bad-function-cast warning, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 107/254: sendrecv: fix MinGW-w64 warning, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 152/254: ssh: ignore timeouts during disconnect, gnunet, 2017/06/17