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.
This commit is contained in:
Michael Jumper 2013-05-17 20:58:47 -07:00
parent 8f0c2f3723
commit 5009d1c280
5 changed files with 7 additions and 32 deletions

View File

@ -50,15 +50,7 @@
*/ */
typedef struct ssh_guac_client_data { typedef struct ssh_guac_client_data {
/** pthread_t client_thread;
* SSH client output thread.
*/
pthread_t output_thread;
/**
* SSH client input thread.
*/
pthread_t input_thread;
ssh_session session; ssh_session session;
ssh_channel term_channel; ssh_channel term_channel;

View File

@ -43,12 +43,7 @@
/** /**
* Main SSH client thread, handling transfer of SSH output to STDOUT. * Main SSH client thread, handling transfer of SSH output to STDOUT.
*/ */
void* ssh_client_output_thread(void* data); void* ssh_client_thread(void* data);
/**
* Secondary SSH client thread, handling transfer of STDIN to SSH input.
*/
void* ssh_client_input_thread(void* data);
#endif #endif

View File

@ -126,15 +126,9 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
client->size_handler = ssh_guac_client_size_handler; client->size_handler = ssh_guac_client_size_handler;
client->free_handler = ssh_guac_client_free_handler; client->free_handler = ssh_guac_client_free_handler;
/* Start client output thread */ /* Start client thread */
if (pthread_create(&(client_data->output_thread), NULL, ssh_client_output_thread, (void*) client)) { if (pthread_create(&(client_data->client_thread), NULL, ssh_client_thread, (void*) client)) {
guac_client_log_error(client, "Unable to start SSH client output thread"); guac_client_log_error(client, "Unable to SSH client 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");
return -1; return -1;
} }

View File

@ -352,8 +352,7 @@ int ssh_guac_client_free_handler(guac_client* client) {
/* Close SSH client */ /* Close SSH client */
close(STDOUT_FILENO); close(STDOUT_FILENO);
close(STDIN_FILENO); close(STDIN_FILENO);
pthread_join(guac_client_data->output_thread, NULL); pthread_join(guac_client_data->client_thread, NULL);
pthread_join(guac_client_data->input_thread, NULL);
/* Free terminal */ /* Free terminal */
guac_terminal_free(guac_client_data->term); guac_terminal_free(guac_client_data->term);

View File

@ -42,7 +42,7 @@
#include "client.h" #include "client.h"
void* ssh_client_output_thread(void* data) { void* ssh_client_thread(void* data) {
/* STUB */ /* STUB */
printf("--- STUB! ---\n"); printf("--- STUB! ---\n");
@ -52,8 +52,3 @@ void* ssh_client_output_thread(void* data) {
} }
void* ssh_client_input_thread(void* data) {
/* STUB */
return NULL;
}