From 5009d1c280ac63cd7e55fc2dac8c48ee69456cbf Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 17 May 2013 20:58:47 -0700 Subject: [PATCH] Revert "Use input/output threads for SSH client." Should actually have one main thread, which then spawns an input thread after connection successful. This reverts commit 6a099b4176fb732b7281128100fe66bb0a72da1a. --- protocols/ssh/include/client.h | 10 +--------- protocols/ssh/include/ssh_client.h | 7 +------ protocols/ssh/src/client.c | 12 +++--------- protocols/ssh/src/guac_handlers.c | 3 +-- protocols/ssh/src/ssh_client.c | 7 +------ 5 files changed, 7 insertions(+), 32 deletions(-) diff --git a/protocols/ssh/include/client.h b/protocols/ssh/include/client.h index 070c6ed1..8a702b11 100644 --- a/protocols/ssh/include/client.h +++ b/protocols/ssh/include/client.h @@ -50,15 +50,7 @@ */ typedef struct ssh_guac_client_data { - /** - * SSH client output thread. - */ - pthread_t output_thread; - - /** - * SSH client input thread. - */ - pthread_t input_thread; + pthread_t client_thread; ssh_session session; ssh_channel term_channel; diff --git a/protocols/ssh/include/ssh_client.h b/protocols/ssh/include/ssh_client.h index 6589943a..e964ba3f 100644 --- a/protocols/ssh/include/ssh_client.h +++ b/protocols/ssh/include/ssh_client.h @@ -43,12 +43,7 @@ /** * Main SSH client thread, handling transfer of SSH output to STDOUT. */ -void* ssh_client_output_thread(void* data); - -/** - * Secondary SSH client thread, handling transfer of STDIN to SSH input. - */ -void* ssh_client_input_thread(void* data); +void* ssh_client_thread(void* data); #endif diff --git a/protocols/ssh/src/client.c b/protocols/ssh/src/client.c index 614b0960..423953bd 100644 --- a/protocols/ssh/src/client.c +++ b/protocols/ssh/src/client.c @@ -126,15 +126,9 @@ int guac_client_init(guac_client* client, int argc, char** argv) { client->size_handler = ssh_guac_client_size_handler; client->free_handler = ssh_guac_client_free_handler; - /* Start client output thread */ - if (pthread_create(&(client_data->output_thread), NULL, ssh_client_output_thread, (void*) client)) { - guac_client_log_error(client, "Unable to start SSH client output thread"); - return -1; - } - - /* Start client input thread */ - if (pthread_create(&(client_data->input_thread), NULL, ssh_client_input_thread, (void*) client)) { - guac_client_log_error(client, "Unable to start SSH client input thread"); + /* Start client thread */ + if (pthread_create(&(client_data->client_thread), NULL, ssh_client_thread, (void*) client)) { + guac_client_log_error(client, "Unable to SSH client thread"); return -1; } diff --git a/protocols/ssh/src/guac_handlers.c b/protocols/ssh/src/guac_handlers.c index 28b01296..f166917a 100644 --- a/protocols/ssh/src/guac_handlers.c +++ b/protocols/ssh/src/guac_handlers.c @@ -352,8 +352,7 @@ int ssh_guac_client_free_handler(guac_client* client) { /* Close SSH client */ close(STDOUT_FILENO); close(STDIN_FILENO); - pthread_join(guac_client_data->output_thread, NULL); - pthread_join(guac_client_data->input_thread, NULL); + pthread_join(guac_client_data->client_thread, NULL); /* Free terminal */ guac_terminal_free(guac_client_data->term); diff --git a/protocols/ssh/src/ssh_client.c b/protocols/ssh/src/ssh_client.c index f90112ca..7c7673e5 100644 --- a/protocols/ssh/src/ssh_client.c +++ b/protocols/ssh/src/ssh_client.c @@ -42,7 +42,7 @@ #include "client.h" -void* ssh_client_output_thread(void* data) { +void* ssh_client_thread(void* data) { /* STUB */ printf("--- STUB! ---\n"); @@ -52,8 +52,3 @@ void* ssh_client_output_thread(void* data) { } -void* ssh_client_input_thread(void* data) { - /* STUB */ - return NULL; -} -