src/libguac/user-handshake.c
/**
 * The thread which handles all user input, calling event handlers for received
 * instructions.
 *
 * @param data
 *     A pointer to a guac_user_input_thread_params structure describing the
 *     user whose input is being handled and the guac_parser with which to
 *     handle it.
 *
 * @return
 *     Always NULL.
 */
The thread which handles all user input, calling event handlers for received
instructions.

@param data
A pointer to a guac_user_input_thread_params structure describing the
user whose input is being handled and the guac_parser with which to
handle it.

@return
Always NULL.
The thread which handles all user input calling event handlers for received instructions . @param data A pointer to a guac_user_input_thread_params structure describing the user whose input is being handled and the guac_parser with which to handle it . @return Always NULL .
static void* guac_user_input_thread(void* data) {
    guac_user_input_thread_params* params =
        (guac_user_input_thread_params*) data;
    int usec_timeout = params->usec_timeout;
    guac_user* user = params->user;
    guac_parser* parser = params->parser;
    guac_client* client = user->client;
    guac_socket* socket = user->socket;
    while (client->state == GUAC_CLIENT_RUNNING && user->active) {
        if (guac_parser_read(parser, socket, usec_timeout)) {
            if (guac_error == GUAC_STATUS_TIMEOUT)
                guac_user_abort(user, GUAC_PROTOCOL_STATUS_CLIENT_TIMEOUT, "User is not responding.");
            else {
                if (guac_error != GUAC_STATUS_CLOSED)
                    guac_user_log_guac_error(user, GUAC_LOG_WARNING,
                            "Guacamole connection failure");
                guac_user_stop(user);
            }
            return NULL;
        }
        guac_error = GUAC_STATUS_SUCCESS;
        guac_error_message = NULL;
        if (__guac_user_call_opcode_handler(__guac_instruction_handler_map, 
                user, parser->opcode, parser->argc, parser->argv)) {
            guac_user_log_guac_error(user, GUAC_LOG_WARNING,
                    "User connection aborted");
            guac_user_log(user, GUAC_LOG_DEBUG, "Failing instruction handler in user was \"%s\"", parser->opcode);
            guac_user_stop(user);
            return NULL;
        }
    }
    return NULL;
}
static void * guac_user_input_thread ( void * data ) { guac_user_input_thread_params * params = ( guac_user_input_thread_params * ) data ; int usec_timeout = params -> usec_timeout ; guac_user * user = params -> user ; guac_parser * parser = params -> parser ; guac_client * client = user -> client ; guac_socket * socket = user -> socket ; while ( client -> state == GUAC_CLIENT_RUNNING && user -> active ) { if ( guac_parser_read ( parser , socket , usec_timeout ) ) { if ( guac_error == GUAC_STATUS_TIMEOUT ) guac_user_abort ( user , GUAC_PROTOCOL_STATUS_CLIENT_TIMEOUT , " " ) ; else { if ( guac_error != GUAC_STATUS_CLOSED ) guac_user_log_guac_error ( user , GUAC_LOG_WARNING , " " ) ; guac_user_stop ( user ) ; } return NULL ; } guac_error = GUAC_STATUS_SUCCESS ; guac_error_message = NULL ; if ( __guac_user_call_opcode_handler ( __guac_instruction_handler_map , user , parser -> opcode , parser -> argc , parser -> argv ) ) { guac_user_log_guac_error ( user , GUAC_LOG_WARNING , " " ) ; guac_user_log ( user , GUAC_LOG_DEBUG , " \" \" " , parser -> opcode ) ; guac_user_stop ( user ) ; return NULL ; } } return NULL ; }
The thread which handles all user input, calling event handlers for received
 instructions.
The thread which handles all user input calling event handlers for received instructions .
/* Guacamole user input loop */ /* Read instruction, stop on error */ /* Reset guac_error and guac_error_message (user/client handlers are not
         * guaranteed to set these) */ /* Call handler, stop on error */ /* Log error */ /* Log handler details */