GUACAMOLE-221: Sockets start keep alive by default.

This commit is contained in:
Nick Couchman 2020-06-27 22:43:25 -04:00
parent c579e7337f
commit 0761908a77
6 changed files with 12 additions and 16 deletions

View File

@ -136,6 +136,10 @@ void guac_socket_free(guac_socket* socket);
* to ensure neither side of the socket times out while the socket is open.
* This ping will take the form of a "nop" instruction.
*
* @deprecated
* Manually starting the keep alive process on sockets is no longer
* necessary, as the sockets enable the "nop" ping by default.
*
* @param socket
* The guac_socket to declare as requiring an automatic keep-alive ping.
*/

View File

@ -150,8 +150,10 @@ guac_socket* guac_socket_alloc() {
socket->state = GUAC_SOCKET_OPEN;
socket->last_write_timestamp = guac_timestamp_current();
/* No keep alive ping by default */
socket->__keep_alive_enabled = 0;
/* keep alive ping by default */
socket->__keep_alive_enabled = 1;
pthread_create(&(socket->__keep_alive_thread), NULL,
__guac_socket_keep_alive_thread, (void*) socket);
/* No handlers yet */
socket->read_handler = NULL;

View File

@ -257,8 +257,7 @@ static BOOL rdp_freerdp_authenticate(freerdp* instance, char** username,
/* Lock the client thread. */
pthread_mutex_lock(&(rdp_client->rdp_credential_lock));
/* Send require params and flush socket. */
guac_socket_require_keep_alive(client->socket);
/* Send require parameters to the owner. */
guac_client_owner_send_required(client, (const char**) params);
/* Wait for condition. */

View File

@ -77,8 +77,7 @@ static void guac_ssh_get_credential(guac_client *client, char* cred_name) {
/* Lock the terminal thread while prompting for the credential. */
pthread_mutex_lock(&(ssh_client->term_channel_lock));
/* Let the owner know what we require and flush the socket. */
guac_socket_require_keep_alive(client->socket);
/* Let the owner know what we require. */
guac_client_owner_send_required(client, (const char* []) {cred_name, NULL});
/* Wait for the response, and then unlock the thread. */
@ -272,9 +271,6 @@ void* ssh_client_thread(void* data) {
return NULL;
}
/* Ensure connection is kept alive during lengthy connects */
guac_socket_require_keep_alive(client->socket);
/* Open SSH session */
ssh_client->session = guac_common_ssh_create_session(client,
settings->hostname, settings->port, ssh_client->user, settings->server_alive_interval,

View File

@ -41,8 +41,7 @@ char* guac_vnc_get_password(rfbClient* client) {
/* Lock the thread. */
pthread_mutex_lock(&(vnc_client->vnc_credential_lock));
/* Send the request for password and flush the socket. */
guac_socket_require_keep_alive(gc->socket);
/* Send the request for password to the owner. */
guac_client_owner_send_required(gc,
(const char* []) {GUAC_VNC_PARAMETER_NAME_PASSWORD, NULL});
@ -91,8 +90,7 @@ rfbCredential* guac_vnc_get_credentials(rfbClient* client, int credentialType) {
/* Lock the thread. */
pthread_mutex_lock(&(vnc_client->vnc_credential_lock));
/* Send required parameters to client and flush the socket. */
guac_socket_require_keep_alive(gc->socket);
/* Send required parameters to owner. */
guac_client_owner_send_required(gc, (const char**) params);
/* Wait for the parameters to be returned. */

View File

@ -259,9 +259,6 @@ void* guac_vnc_client_thread(void* data) {
"clipboard encoding: '%s'.", settings->clipboard_encoding);
}
/* Ensure connection is kept alive during lengthy connects */
guac_socket_require_keep_alive(client->socket);
/* Set up libvncclient logging */
rfbClientLog = guac_vnc_client_log_info;
rfbClientErr = guac_vnc_client_log_error;