Error handling in guac_start_client.

This commit is contained in:
Michael Jumper 2011-03-19 16:44:06 -07:00
parent 71d59845e9
commit a72df19449
2 changed files with 8 additions and 6 deletions

View File

@ -296,8 +296,11 @@ guac_client* guac_get_client(int client_fd);
* Enter the main network message handling loop for the given client.
*
* @param client The proxy client to start handling messages of/for.
* @return Zero if the client successfully started, non-zero if an error
* occurs during startup. Note that this function will still return
* zero if an error occurs while the client is running.
*/
void guac_start_client(guac_client* client);
int guac_start_client(guac_client* client);
/**
* Free all resources associated with the given client.

View File

@ -387,18 +387,16 @@ void* __guac_client_input_thread(void* data) {
}
void guac_start_client(guac_client* client) {
int guac_start_client(guac_client* client) {
pthread_t input_thread, output_thread;
if (pthread_create(&output_thread, NULL, __guac_client_output_thread, (void*) client)) {
/* THIS FUNCTION SHOULD RETURN A VALUE! */
return;
return -1;
}
if (pthread_create(&input_thread, NULL, __guac_client_input_thread, (void*) client)) {
/* THIS FUNCTION SHOULD RETURN A VALUE! */
return;
return -1;
}
/* Wait for I/O threads */
@ -406,6 +404,7 @@ void guac_start_client(guac_client* client) {
pthread_join(output_thread, NULL);
/* Done */
return 0;
}