GUACAMOLE-203: Warn user if they try to enter keepalive value < 2 seconds.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/99936842
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/99936842
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/99936842

Branch: refs/heads/master
Commit: 999368420583263207d669165946e217c556af76
Parents: 1e3d82c
Author: Nick Couchman <vn...@apache.org>
Authored: Wed May 31 19:47:09 2017 -0400
Committer: Nick Couchman <nick.couch...@yahoo.com>
Committed: Wed May 31 21:03:06 2017 -0400

----------------------------------------------------------------------
 src/protocols/ssh/settings.c | 3 +++
 src/protocols/ssh/ssh.c      | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/99936842/src/protocols/ssh/settings.c
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/settings.c b/src/protocols/ssh/settings.c
index 8843923..9859415 100644
--- a/src/protocols/ssh/settings.c
+++ b/src/protocols/ssh/settings.c
@@ -291,6 +291,9 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user,
     settings->server_alive_interval =
         guac_user_parse_args_int(user, GUAC_SSH_CLIENT_ARGS, argv,
                 IDX_SERVER_ALIVE_INTERVAL, 0);
+    if (settings->server_alive_interval == 1)
+        guac_user_log(user, GUAC_LOG_WARNING, "Minimum keepalive interval "
+                " for libssh2 is 2 seconds.");
 
     /* Parsing was successful */
     return settings;

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/99936842/src/protocols/ssh/ssh.c
----------------------------------------------------------------------
diff --git a/src/protocols/ssh/ssh.c b/src/protocols/ssh/ssh.c
index a1b3d93..2504df9 100644
--- a/src/protocols/ssh/ssh.c
+++ b/src/protocols/ssh/ssh.c
@@ -225,7 +225,7 @@ void* ssh_client_thread(void* data) {
     }
 
     /* Set keepalive configuration for session */
-    if (settings->server_alive_interval > 1)
+    if (settings->server_alive_interval > 0)
         libssh2_keepalive_config(ssh_client->session->session, 1, 
settings->server_alive_interval);
 
     pthread_mutex_init(&ssh_client->term_channel_lock, NULL);
@@ -339,7 +339,7 @@ void* ssh_client_thread(void* data) {
         }
 
         /* Send keepalive at configured interval */
-        if (settings->server_alive_interval > 1) {
+        if (settings->server_alive_interval > 0) {
             int timeout = 0;
             if(libssh2_keepalive_send(ssh_client->session->session, &timeout) 
> 0)
                 break;

Reply via email to