summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c9
-rw-r--r--src/ssh.c6
-rw-r--r--src/ssh.h1
3 files changed, 14 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index c172d13..c91447e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -82,7 +82,7 @@ void stop_copy_threads(int sig)
void usage(bool print_help) {
printf("mscp v" VERSION ": copy files over multiple ssh connections\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"
" [-l login_name] [-p port] [-i identity_file]\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"
" -H disable hostkey check\n"
" -d increment ssh debug output level\n"
+ " -N disable tcp nodelay (default on)\n"
" -h print this help\n"
"\n");
}
@@ -229,6 +230,7 @@ int main(int argc, char **argv)
char ch;
memset(&opts, 0, sizeof(opts));
+ opts.nodelay = 1;
memset(&m, 0, sizeof(m));
INIT_LIST_HEAD(&m.file_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 = 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) {
case 'n':
m.nr_threads = atoi(optarg);
@@ -327,6 +329,9 @@ int main(int argc, char **argv)
case 'd':
opts.debuglevel++;
break;
+ case 'N':
+ opts.nodelay = 0;
+ break;
case 'h':
usage(true);
return 0;
diff --git a/src/ssh.c b/src/ssh.c
index 7d4f84c..e0d94d7 100644
--- a/src/ssh.c
+++ b/src/ssh.c
@@ -62,6 +62,12 @@ static int ssh_set_opts(ssh_session ssh, struct ssh_opts *opts)
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;
}
diff --git a/src/ssh.h b/src/ssh.h
index 0f6fd52..f44f67f 100644
--- a/src/ssh.h
+++ b/src/ssh.h
@@ -13,6 +13,7 @@ struct ssh_opts {
char *cipher; /* -c */
char *hmac; /* -M */
int compress; /* -C */
+ int nodelay; /* -N */
int debuglevel; /* -v */
bool no_hostkey_check; /* -H */