Compare commits

...

1 Commits

Author SHA1 Message Date
Virtually Nick
520dd5ede3 GUACAMOLE-600: Add support for setting the VNC connection timeout. 2023-02-16 17:48:20 -05:00
3 changed files with 22 additions and 1 deletions

View File

@ -36,6 +36,7 @@
const char* GUAC_VNC_CLIENT_ARGS[] = {
"hostname",
"port",
"timeout",
"read-only",
"encodings",
GUAC_VNC_ARGV_USERNAME,
@ -108,6 +109,11 @@ enum VNC_ARGS_IDX {
*/
IDX_PORT,
/**
* The number of seconds to wait for the connection before timing out.
*/
IDX_TIMEOUT,
/**
* "true" if this connection should be read-only (user input should be
* dropped), "false" or blank otherwise.
@ -405,6 +411,10 @@ guac_vnc_settings* guac_vnc_parse_args(guac_user* user,
guac_user_parse_args_int(user, GUAC_VNC_CLIENT_ARGS, argv,
IDX_PORT, 0);
settings->timeout =
guac_user_parse_args_int(user, GUAC_VNC_CLIENT_ARGS, argv,
IDX_TIMEOUT, GUAC_VNC_DEFAULT_CONNECTION_TIMEOUT);
settings->username =
guac_user_parse_args_string(user, GUAC_VNC_CLIENT_ARGS, argv,
IDX_USERNAME, NULL);

View File

@ -25,6 +25,11 @@
#include <stdbool.h>
/**
* The default number of seconds to wait for a connection before timing out.
*/
#define GUAC_VNC_DEFAULT_CONNECTION_TIMEOUT 10
/**
* The filename to use for the screen recording, if not specified.
*/
@ -45,6 +50,11 @@ typedef struct guac_vnc_settings {
*/
int port;
/**
* The number of seconds to wait for the connection before timing out.
*/
int timeout;
/**
* The username given in the arguments.
*/

View File

@ -201,9 +201,10 @@ rfbClient* guac_vnc_get_client(guac_client* client) {
rfb_client->MallocFrameBuffer = guac_vnc_malloc_framebuffer;
rfb_client->canHandleNewFBSize = 1;
/* Set hostname and port */
/* Set hostname, port, and timeout */
rfb_client->serverHost = strdup(vnc_settings->hostname);
rfb_client->serverPort = vnc_settings->port;
rfb_client->connectTimeout = vnc_settings->timeout;
#ifdef ENABLE_VNC_REPEATER
/* Set repeater parameters if specified */