Example #1
0
File: main.c Project: nabto/unabto
int main(int argc, char** argv)
{
    nabto_main_setup* nms = unabto_init_context();

    platform_checks();
        
#if NABTO_ENABLE_EPOLL
    unabto_epoll_init();
#endif

    if (!tunnel_parse_args(argc, argv, nms)) {
        NABTO_LOG_FATAL(("failed to parse commandline args"));
    }

#if HANDLE_SIGNALS
#ifdef WIN32
    signal_event = CreateEvent(NULL, FALSE, FALSE, NULL);
#endif
    signal(SIGTERM, handle_signal);
    signal(SIGINT, handle_signal);
#endif

#if NABTO_ENABLE_EPOLL
    if (useSelectBased) {
        tunnel_loop_select();
    } else {
        tunnel_loop_epoll();
    }
#else
    tunnel_loop_select();
#endif
    return 0;
}
Example #2
0
int main(int argc, char** argv)
{
#if USE_TEST_WEBSERVER
#ifdef WIN32
    HANDLE testWebserverThread;
#else
    pthread_t testWebserverThread;
#endif
#endif

    nabto_main_setup* nms = unabto_init_context();

    platform_checks();
    
#if NABTO_ENABLE_EPOLL
    unabto_epoll_init();
#endif

    if (!tunnel_parse_args(argc, argv, nms)) {
        NABTO_LOG_FATAL(("failed to parse commandline args"));
    }

#if USE_TEST_WEBSERVER
    if (testWebserver) {
#ifdef WIN32
        testWebserverThread = CreateThread(NULL, 0, test_webserver, (void*)testWebserverPortStr, NULL, NULL);
#else
        pthread_create(&testWebserverThread, NULL, test_webserver, (void*)testWebserverPortStr);
#endif
    }
#endif

#if HANDLE_SIGNALS
#ifdef WIN32
    signal_event = CreateEvent(NULL, FALSE, FALSE, NULL);
#endif
    signal(SIGTERM, handle_signal);
    signal(SIGINT, handle_signal);
#endif

#if NABTO_ENABLE_EPOLL
    if (useSelectBased) {
        tunnel_loop_select();
    } else {
        tunnel_loop_epoll();
    }
#else
    tunnel_loop_select();
#endif
    return 0;
}