added command line option to change the number of the maximum number of network connection allowed
This commit is contained in:
parent
33ace8e120
commit
f4fd419528
|
@ -143,6 +143,7 @@ parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc)
|
||||||
{"proxy-password", required_argument, NULL, 'L'}, /* 7 */
|
{"proxy-password", required_argument, NULL, 'L'}, /* 7 */
|
||||||
{"cache", required_argument, NULL, 'L'}, /* 8 */
|
{"cache", required_argument, NULL, 'L'}, /* 8 */
|
||||||
{"dl-seg-size", required_argument, NULL, 'L'}, /* 9 */
|
{"dl-seg-size", required_argument, NULL, 'L'}, /* 9 */
|
||||||
|
{"max-conns", required_argument, NULL, 'L'}, /* 10 */
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
while ((c =
|
while ((c =
|
||||||
|
@ -197,6 +198,9 @@ parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc)
|
||||||
case 9:
|
case 9:
|
||||||
DATA_BLK_SZ = atoi(optarg) * 1024 * 1024;
|
DATA_BLK_SZ = atoi(optarg) * 1024 * 1024;
|
||||||
break;
|
break;
|
||||||
|
case 10:
|
||||||
|
NETWORK_CONFIG.max_conns = atoi(optarg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Error: Invalid option\n");
|
fprintf(stderr, "Error: Invalid option\n");
|
||||||
add_arg(fuse_argv, fuse_argc, "--help");
|
add_arg(fuse_argv, fuse_argc, "--help");
|
||||||
|
@ -252,6 +256,8 @@ static void print_http_options()
|
||||||
--cache Set the cache folder\n\
|
--cache Set the cache folder\n\
|
||||||
--dl-seg-size Set the size of each download segment in MB, \n\
|
--dl-seg-size Set the size of each download segment in MB, \n\
|
||||||
default to 8MB\n\
|
default to 8MB\n\
|
||||||
|
--max-conns The maximum number of network connections that\
|
||||||
|
libcurl is allowed to make.\
|
||||||
\n\
|
\n\
|
||||||
libfuse options:\n");
|
libfuse options:\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define NETWORK_MAX_CONNS 10
|
#define DEFAULT_NETWORK_MAX_CONNS 10
|
||||||
|
|
||||||
/* ----------------- External variables ---------------------- */
|
/* ----------------- External variables ---------------------- */
|
||||||
CURLSH *CURL_SHARE;
|
CURLSH *CURL_SHARE;
|
||||||
|
@ -205,7 +205,7 @@ void network_config_init()
|
||||||
NETWORK_CONFIG.proxy = NULL;
|
NETWORK_CONFIG.proxy = NULL;
|
||||||
NETWORK_CONFIG.proxy_user = NULL;
|
NETWORK_CONFIG.proxy_user = NULL;
|
||||||
NETWORK_CONFIG.proxy_pass = NULL;
|
NETWORK_CONFIG.proxy_pass = NULL;
|
||||||
NETWORK_CONFIG.max_conns = NETWORK_MAX_CONNS;
|
NETWORK_CONFIG.max_conns = DEFAULT_NETWORK_MAX_CONNS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkTable *network_init(const char *url)
|
LinkTable *network_init(const char *url)
|
||||||
|
|
Loading…
Reference in New Issue