[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 212/220: curl: make sure the parallel transfers do
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 212/220: curl: make sure the parallel transfers do them all |
Date: |
Thu, 12 Sep 2019 17:29:32 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit bbde0407d1e3750cfc161615491420217b718994
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue Sep 10 13:37:38 2019 +0200
curl: make sure the parallel transfers do them all
The logic could erroneously break the loop too early before all
transfers had been transferred.
Reported-by: Tom van der Woerdt
Fixes #4316
Closes #4317
---
src/tool_operate.c | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 9b5225853..d2ad9642d 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1924,12 +1924,21 @@ static CURLcode create_transfers(struct GlobalConfig
*global,
static long all_added; /* number of easy handles currently added */
+/*
+ * add_parallel_transfers() sets 'morep' to TRUE if there are more transfers
+ * to add even after this call returns. sets 'addedp' to TRUE if one or more
+ * transfers were added.
+ */
static int add_parallel_transfers(struct GlobalConfig *global,
- CURLM *multi)
+ CURLM *multi,
+ bool *morep,
+ bool *addedp)
{
struct per_transfer *per;
CURLcode result;
CURLMcode mcode;
+ *addedp = FALSE;
+ *morep = FALSE;
for(per = transfers; per && (all_added < global->parallel_max);
per = per->next) {
if(per->added)
@@ -1949,7 +1958,9 @@ static int add_parallel_transfers(struct GlobalConfig
*global,
return CURLE_OUT_OF_MEMORY;
per->added = TRUE;
all_added++;
+ *addedp = TRUE;
}
+ *morep = per ? TRUE : FALSE;
return CURLE_OK;
}
@@ -1962,16 +1973,19 @@ static CURLcode parallel_transfers(struct GlobalConfig
*global,
CURLcode result = CURLE_OK;
int still_running = 1;
struct timeval start = tvnow();
+ bool more_transfers;
+ bool added_transfers;
multi = curl_multi_init();
if(!multi)
return CURLE_OUT_OF_MEMORY;
- result = add_parallel_transfers(global, multi);
+ result = add_parallel_transfers(global, multi,
+ &more_transfers, &added_transfers);
if(result)
return result;
- while(!done && !mcode && still_running) {
+ while(!done && !mcode && (still_running || more_transfers)) {
mcode = curl_multi_poll(multi, NULL, 0, 1000, NULL);
if(!mcode)
mcode = curl_multi_perform(multi, &still_running);
@@ -2001,9 +2015,14 @@ static CURLcode parallel_transfers(struct GlobalConfig
*global,
(void)del_transfer(ended);
}
} while(msg);
- if(removed)
+ if(removed) {
/* one or more transfers completed, add more! */
- (void)add_parallel_transfers(global, multi);
+ (void)add_parallel_transfers(global, multi, &more_transfers,
+ &added_transfers);
+ if(added_transfers)
+ /* we added new ones, make sure the loop doesn't exit yet */
+ still_running = 1;
+ }
}
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] 183/220: plan9: fix installation instructions, (continued)
- [GNUnet-SVN] [gnurl] 183/220: plan9: fix installation instructions, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 184/220: curl: fix include conditions, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 211/220: urlapi: one colon is enough for the strspn() input (typo), gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 197/220: urldata: avoid 'generic', use dedicated pointers, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 215/220: gitignore: add sig files., gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 198/220: netrc: free 'home' on error, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 213/220: THANKS: from the 7.66.0 release, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 200/220: KNOWN_BUGS/TODO: cleanup and remove outdated issues, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 206/220: travis: disable ngtcp2 builds (again), gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 193/220: ROADMAP: updated after recent user poll, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 212/220: curl: make sure the parallel transfers do them all,
gnunet <=
- [GNUnet-SVN] [gnurl] 199/220: RELEASE-NOTES: synced, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 217/220: update sed script, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 151/220: http: remove chunked-encoding and expect header use for HTTP/3, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 189/220: CI: remove duplicate configure flag for LGTM.com, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 195/220: smtp: check for and bail out on too short EHLO response, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 205/220: Curl_fillreadbuffer: avoid double-free trailer buf on error, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 204/220: tool_setopt: handle a libcurl build without netrc support, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 194/220: smb: init *msg to NULL in smb_send_and_recv(), gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 207/220: sspi: fix memory leaks, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 209/220: openssl: use SSL_CTX_set_<min|max>_proto_version() when available, gnunet, 2019/09/12