예제 #1
0
zsock_context_t *zsock_create_context()
{
    zsock_context_t *zc;
    type_malloc_clear(zc, zsock_context_t, 1);

    { int result = apr_wrapper_start(); assert(result == APR_SUCCESS); }

    zc->pc = create_hportal_context(&_zsock_base_portal);

    default_zsock_config(zc);

    apr_pool_create(&(zc->mpool), NULL);
    apr_thread_mutex_create(&(zc->lock), APR_THREAD_MUTEX_DEFAULT, zc->mpool);

    if (_zsock_context_count == 0) {
        dns_cache_init(100);
        init_opque_system();
    }

    _zsock_context_count++;

    atomic_set(zc->n_ops, 0);

    return zc;
}
예제 #2
0
파일: zmq_test.c 프로젝트: accre/lstore-gop
int main(int argc, char **argv)
{
    int i, start_option, test_mode;

    if (argc < 2) {
        printf("mq_test [-d log_level] [-c|-s] [-q]\n");
        printf("-c      Client mode\n");
        printf("-s      Server mode\n");
        printf("-h      Host\n");
        printf("**NOTE:  Defaults to launching both client and server for internal testing\n");
        return(0);
    }

    i = 1;

    do {
        start_option = i;

        if (strcmp(argv[i], "-d") == 0) { //** Enable debugging
            i++;
            set_log_level(atol(argv[i]));
            i++;
        } else if (strcmp(argv[i], "-c") == 0) { //** Client mode
            i++;
            test_mode = MODE_CLIENT;
        } else if (strcmp(argv[i], "-s") == 0) { //** Server mode
            i++;
            test_mode = MODE_SERVER;
        } else if (strcmp(argv[i], "-s") == 0) { //** Server mode
            i++;
            host = argv[i];
            i++;
        }
    } while ((start_option < i) && (i<argc));


    apr_wrapper_start();
    init_opque_system();
    init_random();

    if (test_mode == MODE_CLIENT) {
        run_client();
    } else {
        run_server();
    }

    return(0);
}
예제 #3
0
static void gop_construct_fn() {
    apr_status_t ret = apr_initialize();
    assert(ret == APR_SUCCESS);
    init_opque_system();
}