@@ -67,6 +67,7 @@ static size_t arg_chunk_size_avg = 0;
6767static size_t arg_chunk_size_max = 0 ;
6868static uint64_t arg_rate_limit_bps = UINT64_MAX ;
6969static unsigned arg_max_active_chunks = 0 ;
70+ static unsigned arg_max_host_connections = 0 ;
7071static uint64_t arg_with = 0 ;
7172static uint64_t arg_without = 0 ;
7273static uid_t arg_uid_shift = 0 , arg_uid_range = 0x10000U ;
@@ -110,6 +111,9 @@ static void help(void) {
110111 " communication\n"
111112 " --max-active-chunks=MAX Maximum number of simultaneously active chunks for\n"
112113 " remote communication\n"
114+ " --max-host-connections=MAX\n"
115+ " Maximum number of connections to a single host for\n"
116+ " remote communication\n"
113117 " --exclude-nodump=no Don't exclude files with chattr(1)'s +d 'nodump'\n"
114118 " flag when creating archive\n"
115119 " --exclude-submounts=yes Exclude submounts when creating archive\n"
@@ -332,6 +336,7 @@ static int parse_argv(int argc, char *argv[]) {
332336 ARG_CACHE ,
333337 ARG_RATE_LIMIT_BPS ,
334338 ARG_MAX_ACTIVE_CHUNKS ,
339+ ARG_MAX_HOST_CONNECTIONS ,
335340 ARG_WITH ,
336341 ARG_WITHOUT ,
337342 ARG_WHAT ,
@@ -367,6 +372,7 @@ static int parse_argv(int argc, char *argv[]) {
367372 { "cache-auto" , no_argument , NULL , 'c' },
368373 { "rate-limit-bps" , required_argument , NULL , ARG_RATE_LIMIT_BPS },
369374 { "max-active-chunks" , required_argument , NULL , ARG_MAX_ACTIVE_CHUNKS },
375+ { "max-host-connections" , required_argument , NULL , ARG_MAX_HOST_CONNECTIONS },
370376 { "with" , required_argument , NULL , ARG_WITH },
371377 { "without" , required_argument , NULL , ARG_WITHOUT },
372378 { "what" , required_argument , NULL , ARG_WHAT },
@@ -488,6 +494,14 @@ static int parse_argv(int argc, char *argv[]) {
488494 }
489495 break ;
490496
497+ case ARG_MAX_HOST_CONNECTIONS :
498+ r = safe_atou (optarg , & arg_max_host_connections );
499+ if (r < 0 ) {
500+ log_error ("Failed to parse --max-host-connections= value %s" , optarg );
501+ return - EINVAL ;
502+ }
503+ break ;
504+
491505 case ARG_WITH : {
492506 uint64_t u ;
493507
@@ -1349,6 +1363,12 @@ static int verb_make(int argc, char *argv[]) {
13491363 return log_error_errno (r , "Failed to set max active chunks: %m" );
13501364 }
13511365
1366+ if (arg_max_host_connections ) {
1367+ r = ca_sync_set_max_host_connections (s , arg_max_host_connections );
1368+ if (r < 0 )
1369+ return log_error_errno (r , "Failed to set max host connections: %m" );
1370+ }
1371+
13521372 r = ca_sync_set_base_fd (s , input_fd );
13531373 if (r < 0 )
13541374 return log_error_errno (r , "Failed to set sync base: %m" );
@@ -1660,6 +1680,12 @@ static int verb_extract(int argc, char *argv[]) {
16601680 return log_error_errno (r , "Failed to set max active chunks: %m" );
16611681 }
16621682
1683+ if (arg_max_host_connections ) {
1684+ r = ca_sync_set_max_host_connections (s , arg_max_host_connections );
1685+ if (r < 0 )
1686+ return log_error_errno (r , "Failed to set max host connections: %m" );
1687+ }
1688+
16631689 if (seek_path ) {
16641690 if (output_fd >= 0 )
16651691 r = ca_sync_set_boundary_fd (s , output_fd );
@@ -2827,6 +2853,12 @@ static int verb_mount(int argc, char *argv[]) {
28272853 return log_error_errno (r , "Failed to set max active chunks: %m" );
28282854 }
28292855
2856+ if (arg_max_host_connections ) {
2857+ r = ca_sync_set_max_host_connections (s , arg_max_host_connections );
2858+ if (r < 0 )
2859+ return log_error_errno (r , "Failed to set max host connections: %m" );
2860+ }
2861+
28302862 if (operation == MOUNT_ARCHIVE ) {
28312863 if (input_fd >= 0 )
28322864 r = ca_sync_set_archive_fd (s , input_fd );
@@ -2959,6 +2991,12 @@ static int verb_mkdev(int argc, char *argv[]) {
29592991 return log_error_errno (r , "Failed to set max active chunks: %m" );
29602992 }
29612993
2994+ if (arg_max_host_connections ) {
2995+ r = ca_sync_set_max_host_connections (s , arg_max_host_connections );
2996+ if (r < 0 )
2997+ return log_error_errno (r , "Failed to set max host connections: %m" );
2998+ }
2999+
29623000 if (operation == MKDEV_BLOB ) {
29633001 if (input_fd >= 0 )
29643002 r = ca_sync_set_archive_fd (s , input_fd );
@@ -3532,6 +3570,12 @@ static int verb_pull(int argc, char *argv[]) {
35323570 return log_error_errno (r , "Failed to set max active chunks: %m" );
35333571 }
35343572
3573+ if (arg_max_host_connections ) {
3574+ r = ca_remote_set_max_host_connections (rr , arg_max_host_connections );
3575+ if (r < 0 )
3576+ return log_error_errno (r , "Failed to set max host connections: %m" );
3577+ }
3578+
35353579 r = ca_remote_set_io_fds (rr , STDIN_FILENO , STDOUT_FILENO );
35363580 if (r < 0 )
35373581 return log_error_errno (r , "Failed to set I/O file descriptors: %m" );
@@ -3697,6 +3741,12 @@ static int verb_push(int argc, char *argv[]) {
36973741 return log_error_errno (r , "Failed to set max active chunks: %m" );
36983742 }
36993743
3744+ if (arg_max_host_connections ) {
3745+ r = ca_remote_set_max_host_connections (rr , arg_max_host_connections );
3746+ if (r < 0 )
3747+ return log_error_errno (r , "Failed to set max host connections: %m" );
3748+ }
3749+
37003750 r = ca_remote_set_io_fds (rr , STDIN_FILENO , STDOUT_FILENO );
37013751 if (r < 0 )
37023752 log_error_errno (r , "Failed to set I/O file descriptors: %m" );
0 commit comments