[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 121/163: easy_perform: use *multi_timeout() to get
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 121/163: easy_perform: use *multi_timeout() to get wait times |
Date: |
Sun, 05 Aug 2018 12:37:27 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 3ef67c6861c9d6236a4339d3446a444767598a58
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue Jun 26 18:11:32 2018 +0200
easy_perform: use *multi_timeout() to get wait times
... and trim the threaded Curl_resolver_getsock() to return zero
millisecond wait times during the first three milliseconds so that
localhost or names in the OS resolver cache gets detected and used
faster.
Closes #2685
---
lib/asyn-thread.c | 6 +++---
lib/easy.c | 23 ++++++-----------------
2 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
index 894ca459b..c7c1a0086 100644
--- a/lib/asyn-thread.c
+++ b/lib/asyn-thread.c
@@ -574,10 +574,10 @@ int Curl_resolver_getsock(struct connectdata *conn,
(void)socks;
(void)numsocks;
ms = Curl_timediff(Curl_now(), reslv->start);
- if(ms < 10)
- milli = ms/3;
+ if(ms < 3)
+ milli = 0;
else if(ms <= 50)
- milli = 10;
+ milli = ms/3;
else if(ms <= 250)
milli = 50;
else
diff --git a/lib/easy.c b/lib/easy.c
index bf85075e1..5af90e326 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -661,38 +661,27 @@ static CURLcode easy_transfer(struct Curl_multi *multi)
bool done = FALSE;
CURLMcode mcode = CURLM_OK;
CURLcode result = CURLE_OK;
- struct curltime before;
- int without_fds = 0; /* count number of consecutive returns from
- curl_multi_wait() without any filedescriptors */
while(!done && !mcode) {
int still_running = 0;
int rc;
- before = Curl_now();
mcode = curl_multi_wait(multi, NULL, 0, 1000, &rc);
if(!mcode) {
if(!rc) {
- struct curltime after = Curl_now();
+ long sleep_ms;
/* If it returns without any filedescriptor instantly, we need to
avoid busy-looping during periods where it has nothing particular
to wait for */
- if(Curl_timediff(after, before) <= 10) {
- without_fds++;
- if(without_fds > 2) {
- int sleep_ms = without_fds < 10 ? (1 << (without_fds - 1)) : 1000;
- Curl_wait_ms(sleep_ms);
- }
+ curl_multi_timeout(multi, &sleep_ms);
+ if(sleep_ms) {
+ if(sleep_ms > 1000)
+ sleep_ms = 1000;
+ Curl_wait_ms((int)sleep_ms);
}
- else
- /* it wasn't "instant", restart counter */
- without_fds = 0;
}
- else
- /* got file descriptor, restart counter */
- without_fds = 0;
mcode = curl_multi_perform(multi, &still_running);
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 117/163: url: check Curl_conncache_add_conn return code, (continued)
- [GNUnet-SVN] [gnurl] 117/163: url: check Curl_conncache_add_conn return code, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 144/163: CMake: Remove unused 'output_var' from 'collect_true', gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 129/163: openssl: Remove some dead code, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 150/163: schannel: make more cipher options conditional, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 162/163: gnurl: rename CURLINFO and CURLOPT section 3 manpages post-merge, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 124/163: travis: add a build using the synchronous name resolver, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 138/163: example/crawler.c: simple crawler based on libxml2, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 132/163: DEPRECATE: new doc describing planned item removals, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 135/163: DEPRECATE: linkified, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 77/163: boringssl + schannel: undef X509_NAME in lib/schannel.h, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 121/163: easy_perform: use *multi_timeout() to get wait times,
gnunet <=
- [GNUnet-SVN] [gnurl] 81/163: cppcheck: fix warnings, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 149/163: curl_setup: include <winerror.h> before <windows.h>, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 161/163: gnurl: sed script, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 163/163: gnurl: bump version in guix.scm, gnunet, 2018/08/05
- [GNUnet-SVN] [gnurl] 159/163: Merge tag 'curl-7_61_0', gnunet, 2018/08/05