Ejemplo n.º 1
0
void taskmain(int argc, char **argv)
{
    L = luaL_newstate();

    dbg_set_log(stderr);
    int rc = 0;

    check(argc == 3, "usage: mongrel2 config.lua server_name");

    //if(argc == 4) {
    //    log_info("Using configuration module %s to load configs.", argv[3]);
    //    rc = Config_module_load(argv[3]);
    //    check(rc != -1, "Failed to load the config module: %s", argv[3]);
    //}

    Server_queue_init();

    Server *srv = load_server(L, argv[1], argv[2], NULL);
    check(srv != NULL, "Aborting since can't load server.");
    Server_queue_push(srv);

    SuperPoll_get_max_fd();

//    rc = clear_pid_file(srv);
//    check(rc == 0, "PID file failure, aborting rather than trying to start.");

//    rc = attempt_chroot_drop(srv);
//    check(rc == 0, "Major failure in chroot/droppriv, aborting.");

    final_setup();

    taskcreate(tickertask, NULL, TICKER_TASK_STACK);

    struct ServerTask *srv_data = calloc(1, sizeof(struct ServerTask));
    srv_data->db_file = bfromcstr(argv[1]);
    srv_data->server_id = bfromcstr(argv[2]);

//    taskcreate(reload_task, srv_data, RELOAD_TASK_STACK);

    rc = Server_run();
    check(rc != -1, "Server had a failure and exited early.");
    log_info("Server run exited, goodbye.");

    srv = Server_queue_latest();
    complete_shutdown(srv);

    return;

error:
    log_err("Exiting due to error.");
    taskexitall(1);
}
Ejemplo n.º 2
0
char *all_tests() {
    mu_suite_start();

    SuperPoll_get_max_fd();
    TEST_POLL = SuperPoll_create();

    mu_run_test(test_sparse_pipes_hot);
    mu_run_test(test_maxed_pipes_hot);
    mu_run_test(test_midlevel_pipes_hot);

#ifdef __linux__
    mu_run_test(test_sparse_pipes_idle);
    mu_run_test(test_maxed_pipes_idle);
    mu_run_test(test_midlevel_pipes_idle);
    mu_run_test(test_totally_maxed);
#endif

    SuperPoll_destroy(TEST_POLL);

    return NULL;
}