GUACAMOLE-203: Deal correctly with negative keepalive values.

This commit is contained in:
Nick Couchman 2017-06-25 04:49:05 -04:00
parent ed77114038
commit 05dfb1a6ae
4 changed files with 12 additions and 8 deletions

View File

@ -532,16 +532,20 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
return NULL;
}
/* Configure session keepalive */
if (keepalive > 0)
libssh2_keepalive_config(common_session->session, 1, keepalive);
/* Warn if keepalive below minimum value */
if (keepalive == 1) {
if (keepalive < 0) {
keepalive = 0;
guac_client_log(client, GUAC_LOG_WARNING, "negative keepalive intervals "
"are converted to 0, disabling keepalive.");
}
else if(keepalive == 1) {
guac_client_log(client, GUAC_LOG_WARNING, "keepalive interval will "
"be rounded up to minimum value of 2.");
}
/* Configure session keepalive */
libssh2_keepalive_config(common_session->session, 1, keepalive);
/* Return created session */
return common_session;

View File

@ -366,7 +366,7 @@ typedef struct guac_rdp_settings {
* of 1 is automatically increased to 2 by libssh2 to avoid busy loop corner
* cases.
*/
unsigned sftp_server_alive_interval;
int sftp_server_alive_interval;
#endif
/**

View File

@ -189,7 +189,7 @@ typedef struct guac_ssh_settings {
/**
* The number of seconds between sending server alive messages.
*/
unsigned server_alive_interval;
int server_alive_interval;
} guac_ssh_settings;

View File

@ -180,7 +180,7 @@ typedef struct guac_vnc_settings {
* of 1 is automatically increased to 2 by libssh2 to avoid busy loop corner
* cases.
*/
unsigned sftp_server_alive_interval;
int sftp_server_alive_interval;
#endif
/**