quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLMOPT_MAX_HOST_CONNECTIONS.md (2313B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLMOPT_MAX_HOST_CONNECTIONS
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLMOPT_MAXCONNECTS (3)
      9   - CURLMOPT_MAX_TOTAL_CONNECTIONS (3)
     10 Protocol:
     11   - All
     12 Added-in: 7.30.0
     13 ---
     14 
     15 # NAME
     16 
     17 CURLMOPT_MAX_HOST_CONNECTIONS - max number of connections to a single host
     18 
     19 # SYNOPSIS
     20 
     21 ~~~c
     22 #include <curl/curl.h>
     23 
     24 CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_MAX_HOST_CONNECTIONS,
     25                             long max);
     26 ~~~
     27 
     28 # DESCRIPTION
     29 
     30 Pass a long to indicate **max**, the maximum amount of simultaneously open
     31 connections libcurl may hold a single host (a host being the same as a
     32 hostname + port number pair). For each new transfer to the same host, libcurl
     33 might open a new connection up to the limit set by
     34 CURLMOPT_MAX_HOST_CONNECTIONS(3). When the limit is reached, new sessions are
     35 kept pending until a connection becomes available.
     36 
     37 The default **max** value is 0, unlimited. This set limit is also used for
     38 proxy connections, and then the proxy is considered to be the host for which
     39 this limit counts.
     40 
     41 When more transfers are added to the multi handle than what can be performed
     42 due to the set limit, they are queued up waiting for their chance.
     43 
     44 While a transfer is queued up internally waiting for a connection, the
     45 CURLOPT_TIMEOUT_MS(3) timeout is counted inclusive of the waiting time,
     46 meaning that if you set a too narrow timeout the transfer might never even
     47 start before it times out. The CURLOPT_CONNECTTIMEOUT_MS(3) time is also
     48 similarly still treated as a per-connect timeout and might expire even before
     49 making a new connection is permitted.
     50 
     51 Changing this value while there are transfers in progress is possible. The new
     52 value is then used the next time checks are performed. Lowering the value does
     53 not close down any active transfers, it simply does not allow new ones to get
     54 made.
     55 
     56 # DEFAULT
     57 
     58 0
     59 
     60 # %PROTOCOLS%
     61 
     62 # EXAMPLE
     63 
     64 ~~~c
     65 int main(void)
     66 {
     67   CURLM *m = curl_multi_init();
     68   /* do no more than 2 connections per host */
     69   curl_multi_setopt(m, CURLMOPT_MAX_HOST_CONNECTIONS, 2L);
     70 }
     71 ~~~
     72 
     73 # %AVAILABILITY%
     74 
     75 # RETURN VALUE
     76 
     77 curl_multi_setopt(3) returns a CURLMcode indicating success or error.
     78 
     79 CURLM_OK (0) means everything was OK, non-zero means an error occurred, see
     80 libcurl-errors(3).