aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-10-17 10:05:53 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-11-21 16:36:10 +0100
commit215baa74f709cd5026ea037eb9204cee93baa1bb (patch)
tree8a766a63c02e2c031cd366fbc667fad4e333036d /src
parent8487734e8bc2783448da135355e05302947bf830 (diff)
curl: add --parallel-immediate
Starting with this change when doing parallel transfers, without this option set, curl will prefer to create new transfers multiplexed on an existing connection rather than creating a brand new one. --parallel-immediate can be set to tell curl to prefer to use new connections rather than to wait and try to multiplex. libcurl-wise, this means that curl will set CURLOPT_PIPEWAIT by default on parallel transfers. Suggested-by: Tom van der Woerdt Closes #4500
Diffstat (limited to 'src')
-rw-r--r--src/tool_cfgable.h1
-rw-r--r--src/tool_getparam.c4
-rw-r--r--src/tool_help.c2
-rw-r--r--src/tool_operate.c4
4 files changed, 11 insertions, 0 deletions
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index 7232c35e3..4372cc6fc 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -300,6 +300,7 @@ struct GlobalConfig {
#endif
bool parallel;
long parallel_max;
+ bool parallel_connect;
struct OperationConfig *first;
struct OperationConfig *current;
struct OperationConfig *last; /* Always last in the struct */
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 3882cb97e..75faff34d 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -321,6 +321,7 @@ static const struct LongShort aliases[]= {
{"z", "time-cond", ARG_STRING},
{"Z", "parallel", ARG_BOOL},
{"Zb", "parallel-max", ARG_STRING},
+ {"Zc", "parallel-immediate", ARG_BOOL},
{"#", "progress-bar", ARG_BOOL},
{"#m", "progress-meter", ARG_BOOL},
{":", "next", ARG_NONE},
@@ -2154,6 +2155,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
(global->parallel_max < 1))
global->parallel_max = PARALLEL_DEFAULT;
break;
+ case 'c': /* --parallel-connect */
+ global->parallel_connect = toggle;
+ break;
}
break;
case 'z': /* time condition coming up */
diff --git a/src/tool_help.c b/src/tool_help.c
index 022956676..21900108b 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -279,6 +279,8 @@ static const struct helptxt helptext[] = {
"Write to file instead of stdout"},
{"-Z, --parallel",
"Perform transfers in parallel"},
+ {" --parallel-immediate",
+ "Do not wait for multiplexing (with --parallel)"},
{" --parallel-max",
"Maximum concurrency for parallel transfers"},
{" --pass <phrase>",
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 4ecb1ed5f..0de81cd49 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1976,6 +1976,10 @@ static CURLcode add_parallel_transfers(struct GlobalConfig *global,
if(result)
break;
+ /* parallel connect means that we don't set PIPEWAIT since pipewait
+ will make libcurl prefer multiplexing */
+ (void)curl_easy_setopt(per->curl, CURLOPT_PIPEWAIT,
+ global->parallel_connect ? 0L : 1L);
(void)curl_easy_setopt(per->curl, CURLOPT_PRIVATE, per);
(void)curl_easy_setopt(per->curl, CURLOPT_XFERINFOFUNCTION, xferinfo_cb);
(void)curl_easy_setopt(per->curl, CURLOPT_XFERINFODATA, per);