]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: add --parallel-immediate
authorDaniel Stenberg <daniel@haxx.se>
Thu, 17 Oct 2019 08:05:53 +0000 (10:05 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 21 Nov 2019 15:36:10 +0000 (16:36 +0100)
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

docs/cmdline-opts/Makefile.inc
docs/cmdline-opts/parallel-immediate.d [new file with mode: 0644]
src/tool_cfgable.h
src/tool_getparam.c
src/tool_help.c
src/tool_operate.c

index c90e9c5fb534f66d12ef01d91e8c1000ce9954c2..fd29dfb23ea89bec91934823c8961103d305cf80 100644 (file)
@@ -103,9 +103,10 @@ DPAGES =                                   \
   ntlm.d ntlm-wb.d                             \
   oauth2-bearer.d                              \
   output.d                                      \
+  parallel-immediate.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-immediate.d b/docs/cmdline-opts/parallel-immediate.d
new file mode 100644 (file)
index 0000000..3439310
--- /dev/null
@@ -0,0 +1,9 @@
+Long: parallel-immediate
+Help: Do not wait for multiplexing (with --parallel)
+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 at once rather than
+waiting to see if new transfers can be added as multiplexed streams on another
+connection.
index 7232c35e3af82378f8fd5a4abd8035b2ecc40ee8..4372cc6fc6a14216eef35fb77a57117728db9406 100644 (file)
@@ -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 */
index 3882cb97ecc2f56050d7c67e3ebc8ee36fb79218..75faff34d710433f5e0d2a97fdc451c64fd28a13 100644 (file)
@@ -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 */
index 022956676ce5a44e7b75664b0d6016fb34ce9abb..21900108b5867eea28d956834968b476f521a417 100644 (file)
@@ -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>",
index 4ecb1ed5fb19fd11534c69aab315c59555d3d96f..0de81cd49b2a2b6240a2b4726653bdfffa276e9f 100644 (file)
@@ -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);