mirror of
https://github.com/upa/mscp.git
synced 2026-05-13 05:17:29 +08:00
set TCP_NODELAY by default and introduce -N option to disable it
This commit is contained in:
@@ -82,7 +82,7 @@ void stop_copy_threads(int sig)
|
|||||||
void usage(bool print_help) {
|
void usage(bool print_help) {
|
||||||
printf("mscp v" VERSION ": copy files over multiple ssh connections\n"
|
printf("mscp v" VERSION ": copy files over multiple ssh connections\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Usage: mscp [vqDCHdh] [-n nr_conns] [-m coremask]\n"
|
"Usage: mscp [vqDCHdNh] [-n nr_conns] [-m coremask]\n"
|
||||||
" [-s min_chunk_sz] [-S max_chunk_sz] [-a nr_ahead] [-b buf_sz]\n"
|
" [-s min_chunk_sz] [-S max_chunk_sz] [-a nr_ahead] [-b buf_sz]\n"
|
||||||
" [-l login_name] [-p port] [-i identity_file]\n"
|
" [-l login_name] [-p port] [-i identity_file]\n"
|
||||||
" [-c cipher_spec] [-M hmac_spec] source ... target\n"
|
" [-c cipher_spec] [-M hmac_spec] source ... target\n"
|
||||||
@@ -111,6 +111,7 @@ void usage(bool print_help) {
|
|||||||
" -C enable compression on libssh\n"
|
" -C enable compression on libssh\n"
|
||||||
" -H disable hostkey check\n"
|
" -H disable hostkey check\n"
|
||||||
" -d increment ssh debug output level\n"
|
" -d increment ssh debug output level\n"
|
||||||
|
" -N disable tcp nodelay (default on)\n"
|
||||||
" -h print this help\n"
|
" -h print this help\n"
|
||||||
"\n");
|
"\n");
|
||||||
}
|
}
|
||||||
@@ -229,6 +230,7 @@ int main(int argc, char **argv)
|
|||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
memset(&opts, 0, sizeof(opts));
|
memset(&opts, 0, sizeof(opts));
|
||||||
|
opts.nodelay = 1;
|
||||||
memset(&m, 0, sizeof(m));
|
memset(&m, 0, sizeof(m));
|
||||||
INIT_LIST_HEAD(&m.file_list);
|
INIT_LIST_HEAD(&m.file_list);
|
||||||
INIT_LIST_HEAD(&m.chunk_list);
|
INIT_LIST_HEAD(&m.chunk_list);
|
||||||
@@ -238,7 +240,7 @@ int main(int argc, char **argv)
|
|||||||
m.nr_threads = (int)(nr_cpus() / 2);
|
m.nr_threads = (int)(nr_cpus() / 2);
|
||||||
m.nr_threads = m.nr_threads == 0 ? 1 : m.nr_threads;
|
m.nr_threads = m.nr_threads == 0 ? 1 : m.nr_threads;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "n:m:s:S:a:b:vqDl:p:i:c:M:CHdh")) != -1) {
|
while ((ch = getopt(argc, argv, "n:m:s:S:a:b:vqDl:p:i:c:M:CHdNh")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'n':
|
case 'n':
|
||||||
m.nr_threads = atoi(optarg);
|
m.nr_threads = atoi(optarg);
|
||||||
@@ -327,6 +329,9 @@ int main(int argc, char **argv)
|
|||||||
case 'd':
|
case 'd':
|
||||||
opts.debuglevel++;
|
opts.debuglevel++;
|
||||||
break;
|
break;
|
||||||
|
case 'N':
|
||||||
|
opts.nodelay = 0;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage(true);
|
usage(true);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -62,6 +62,12 @@ static int ssh_set_opts(ssh_session ssh, struct ssh_opts *opts)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opts->nodelay &&
|
||||||
|
ssh_options_set(ssh, SSH_OPTIONS_NODELAY, &opts->nodelay) < 0) {
|
||||||
|
pr_err("failed to set nodelay\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ struct ssh_opts {
|
|||||||
char *cipher; /* -c */
|
char *cipher; /* -c */
|
||||||
char *hmac; /* -M */
|
char *hmac; /* -M */
|
||||||
int compress; /* -C */
|
int compress; /* -C */
|
||||||
|
int nodelay; /* -N */
|
||||||
int debuglevel; /* -v */
|
int debuglevel; /* -v */
|
||||||
bool no_hostkey_check; /* -H */
|
bool no_hostkey_check; /* -H */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user