diff options
author | Daniel Stenberg <daniel@haxx.se> | 2019-10-17 10:05:53 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2019-10-17 10:05:53 +0200 |
commit | d056dbb5beeb5d537e71725045c473bf5874578d (patch) | |
tree | a04d86bb24497b3ee0bd48d7e7e8884a5a0878c7 | |
parent | ce07f0b8a1ca91301f7fc79b5b0af95ed41bfd11 (diff) | |
download | curl-bagder/parallel-connect.tar.gz |
curl: add --parallel-connectbagder/parallel-connect
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-connect 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
-rw-r--r-- | docs/cmdline-opts/Makefile.inc | 3 | ||||
-rw-r--r-- | docs/cmdline-opts/parallel-connect.d | 9 | ||||
-rw-r--r-- | src/tool_cfgable.h | 1 | ||||
-rw-r--r-- | src/tool_getparam.c | 4 | ||||
-rw-r--r-- | src/tool_help.c | 2 | ||||
-rw-r--r-- | src/tool_operate.c | 4 |
6 files changed, 22 insertions, 1 deletions
diff --git a/docs/cmdline-opts/Makefile.inc b/docs/cmdline-opts/Makefile.inc index c90e9c5fb..9743cafca 100644 --- a/docs/cmdline-opts/Makefile.inc +++ b/docs/cmdline-opts/Makefile.inc @@ -103,9 +103,10 @@ DPAGES = \ ntlm.d ntlm-wb.d \ oauth2-bearer.d \ output.d \ + parallel-connect.d \ + parallel-max.d \ parallel.d \ pass.d \ - parallel-max.d \ path-as-is.d \ pinnedpubkey.d \ post301.d \ diff --git a/docs/cmdline-opts/parallel-connect.d b/docs/cmdline-opts/parallel-connect.d new file mode 100644 index 000000000..a51e12e85 --- /dev/null +++ b/docs/cmdline-opts/parallel-connect.d @@ -0,0 +1,9 @@ +Long: parallel-connect +Help: Prefer parallel connections to multiplexed ones +Added: 7.68.0 +See-also: parallel parallel-max +--- +When doing parallel transfers, this option will instruct curl that it should +rather prefer opening up more connections in parallel rather than risk waiting +to see if new transfers can be added as multiplexed streams on another +connection. 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..d49b7031b 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-connect", 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..7de19dc8f 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-connect", + "Prefer parallel connections to multiplexed ones"}, {" --parallel-max", "Maximum concurrency for parallel transfers"}, {" --pass <phrase>", diff --git a/src/tool_operate.c b/src/tool_operate.c index 3087d2d14..c0ca45756 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -1973,6 +1973,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); |