GUACAMOLE-221: Move keep-alives to protocol implementation and only send required instruction to owner.

This commit is contained in:
Nick Couchman 2020-06-27 17:55:43 -04:00
parent 5c309f5cb1
commit 5881209f12
4 changed files with 10 additions and 10 deletions

View File

@ -981,9 +981,6 @@ int guac_protocol_send_required(guac_socket* socket, const char** required) {
guac_socket_instruction_begin(socket);
// The socket should be kept alive while waiting for user response.
guac_socket_require_keep_alive(socket);
if (guac_socket_write_string(socket, "8.required"))
return -1;

View File

@ -258,8 +258,9 @@ static BOOL rdp_freerdp_authenticate(freerdp* instance, char** username,
pthread_mutex_lock(&(rdp_client->rdp_credential_lock));
/* Send require params and flush socket. */
guac_protocol_send_required(client->socket, (const char**) params);
guac_socket_flush(client->socket);
guac_socket_require_keep_alive(client->__owner->socket);
guac_protocol_send_required(client->__owner->socket, (const char**) params);
guac_socket_flush(client->__owner->socket);
/* Wait for condition. */
pthread_cond_wait(&(rdp_client->rdp_credential_cond), &(rdp_client->rdp_credential_lock));

View File

@ -76,9 +76,10 @@ 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 client know what we require and flush the socket. */
guac_protocol_send_required(client->socket, (const char* []) {cred_name, NULL});
guac_socket_flush(client->socket);
/* Let the owner know what we require and flush the socket. */
guac_socket_require_keep_alive(client->__owner->socket);
guac_protocol_send_required(client->__owner->socket, (const char* []) {cred_name, NULL});
guac_socket_flush(client->__owner->socket);
/* Wait for the response, and then unlock the thread. */
pthread_cond_wait(&(ssh_client->ssh_credential_cond), &(ssh_client->term_channel_lock));

View File

@ -42,9 +42,10 @@ char* guac_vnc_get_password(rfbClient* client) {
pthread_mutex_lock(&(vnc_client->vnc_credential_lock));
/* Send the request for password and flush the socket. */
guac_protocol_send_required(gc->socket,
guac_socket_require_keep_alive(gc->__owner->socket);
guac_protocol_send_required(gc->__owner->socket,
(const char* []) {"password", NULL});
guac_socket_flush(gc->socket);
guac_socket_flush(gc->__owner->socket);
/* Set the conditional flag. */
vnc_client->vnc_credential_flags |= GUAC_VNC_COND_FLAG_PASSWORD;