added retry-wait command line option
This commit is contained in:
parent
2d91734ade
commit
7c1c1d2195
|
@ -143,6 +143,7 @@ parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc)
|
|||
{"dl-seg-size", required_argument, NULL, 'L'}, /* 9 */
|
||||
{"max-conns", required_argument, NULL, 'L'}, /* 10 */
|
||||
{"user-agent", required_argument, NULL, 'L'}, /* 11 */
|
||||
{"retry-wait", required_argument, NULL, 'L'}, /* 12 */
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
while ((c =
|
||||
|
@ -201,6 +202,9 @@ parse_arg_list(int argc, char **argv, char ***fuse_argv, int *fuse_argc)
|
|||
case 11:
|
||||
NETWORK_CONFIG.user_agent = strdup(optarg);
|
||||
break;
|
||||
case 12:
|
||||
HTTP_429_WAIT = atoi(optarg);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Error: Invalid option\n");
|
||||
add_arg(fuse_argv, fuse_argc, "--help");
|
||||
|
@ -254,11 +258,14 @@ static void print_http_options()
|
|||
--proxy-username Username for the proxy\n\
|
||||
--proxy-password Password for the proxy\n\
|
||||
--cache Set a cache folder, by default this is disabled\n\
|
||||
--dl-seg-size The size of each download segment in MB, \n\
|
||||
--dl-seg-size The size of each download segment in MB,\n\
|
||||
default to 8MB.\n\
|
||||
--max-conns The maximum number of network connections that\
|
||||
libcurl is allowed to make, default to 10.\
|
||||
--user-agent The user agent string, default to \"HTTPDirFS\".\
|
||||
--retry-wait The waiting interval in seconds before making an\
|
||||
HTTP request, after encountering an error, default\
|
||||
to 5 seconds.\
|
||||
\n\
|
||||
libfuse options:\n");
|
||||
}
|
||||
|
|
|
@ -9,10 +9,12 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#define DEFAULT_NETWORK_MAX_CONNS 10
|
||||
#define DEFAULT_HTTP_429_WAIT 5
|
||||
|
||||
/* ----------------- External variables ---------------------- */
|
||||
CURLSH *CURL_SHARE;
|
||||
NetworkConfigStruct NETWORK_CONFIG;
|
||||
int HTTP_429_WAIT = DEFAULT_HTTP_429_WAIT;
|
||||
|
||||
/* ----------------- Static variable ----------------------- */
|
||||
/** \brief curl multi interface handle */
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
#include "link.h"
|
||||
|
||||
#define HTTP_429_WAIT 5
|
||||
|
||||
typedef enum {
|
||||
HTTP_OK = 200,
|
||||
HTTP_PARTIAL_CONTENT = 206,
|
||||
|
@ -36,8 +34,12 @@ typedef struct {
|
|||
char *proxy_pass;
|
||||
long max_conns;
|
||||
char *user_agent;
|
||||
int http_429_wait;
|
||||
} NetworkConfigStruct;
|
||||
|
||||
/** \brief The waiting time after getting HTTP 429 */
|
||||
extern int HTTP_429_WAIT;
|
||||
|
||||
/** \brief CURL configuration */
|
||||
extern NetworkConfigStruct NETWORK_CONFIG;
|
||||
|
||||
|
|
Loading…
Reference in New Issue