static void s_on_client_connection_setup()

in source/rest.c [30:47]


static void s_on_client_connection_setup(struct aws_http_connection *connection, int error_code, void *user_data) {
    struct aws_nitro_enclaves_rest_client *rest_client = user_data;

    /* TODO: Proper logging. */
    if (error_code) {
        fprintf(stderr, "Connection failed with error %s\n", aws_error_debug_str(error_code));
    } else if (error_code == 0 && connection != NULL) {
        fprintf(stderr, "Connected.\n");

        /* A valid connection context. */
        aws_mutex_lock(&rest_client->mutex);
        rest_client->connection = connection;
        aws_mutex_unlock(&rest_client->mutex);
    }

    /* Notify waiting client on the connection outcome. */
    aws_condition_variable_notify_all(&rest_client->c_var);
}