Esempio n. 1
0
void client_main(CLI *c) {
    s_log(LOG_DEBUG, "Service [%s] started", c->opt->servname);
    if(c->opt->option.program && c->opt->option.remote) {
            /* exec and connect options specified together
             * -> spawn a local program instead of stdio */
        for(;;) {
            SERVICE_OPTIONS *opt=c->opt;
            memset(c, 0, sizeof(CLI)); /* connect_local needs clean c */
            c->opt=opt;
            if(!setjmp(c->err))
                c->local_rfd.fd=c->local_wfd.fd=connect_local(c);
            else
                break;
            client_run(c);
            if(!c->opt->option.retry)
                break;
            sleep(1); /* FIXME: not a good idea in ucontext threading */
            str_stats();
            if(service_options.next) /* don't str_cleanup in inetd mode */
                str_cleanup();
        }
    } else
        client_run(c);
    str_free(c);
}
Esempio n. 2
0
void main_cleanup() {
    unbind_ports();
    s_poll_free(fds);
    fds=NULL;
#if 0
    str_stats(); /* main thread allocation tracking */
#endif
    log_flush(LOG_MODE_ERROR);
}
Esempio n. 3
0
File: stunnel.c Progetto: ssem/rat
void main_cleanup() {
    unbind_ports();
    s_poll_free(fds);
    fds=NULL;
#if 0
    str_stats(); /* main thread allocation tracking */
#endif
    log_flush(LOG_MODE_ERROR);
#if !defined(USE_WIN32) && !defined(__vms)
    syslog_close();
#endif /* !defined(USE_WIN32) && !defined(__vms) */
}
Esempio n. 4
0
File: client.c Progetto: l7s/stunnel
void *client(void *arg) {
    CLI *c=arg;

#ifdef DEBUG_STACK_SIZE
    stack_info(1); /* initialize */
#endif
    s_log(LOG_DEBUG, "Service %s started", c->opt->servname);
    if(c->opt->option.remote && c->opt->option.program) {
            /* connect and exec options specified together */
            /* -> spawn a local program instead of stdio */
        while((c->local_rfd.fd=c->local_wfd.fd=connect_local(c))>=0) {
            run_client(c);
            if(!c->opt->option.retry)
                break;
            sleep(1); /* FIXME: not a good idea in ucontext threading */
            str_stats();
            str_cleanup();
        }
    } else
        run_client(c);
    /* str_free() cannot be used here, because corresponding
       calloc() is called from a different thread */
    free(c);
#ifdef DEBUG_STACK_SIZE
    stack_info(0); /* display computed value */
#endif
#ifdef USE_UCONTEXT
    s_log(LOG_DEBUG, "Context %ld closed", ready_head->id);
#endif
    str_stats();
    str_cleanup();
    /* s_log() is not allowed after str_cleanup() */
#if defined(USE_WIN32) && !defined(_WIN32_WCE)
    _endthread();
#endif
#ifdef USE_UCONTEXT
    s_poll_wait(NULL, 0, 0); /* wait on poll() */
#endif
    return NULL;
}
Esempio n. 5
0
int main(int argc, char** argv)
{
  if (2 > argc)
  {
    printf("Nombre de paramètres insuffisant\n");

    return 1;
  }

    char* input = argv[1];

    str_stats(input);

    return 0;
}
Esempio n. 6
0
int main(int argc, char* argv[]) { /* execution begins here 8-) */
    int retval;

#ifdef M_MMAP_THRESHOLD
    mallopt(M_MMAP_THRESHOLD, 4096);
#endif
    str_init(); /* initialize per-thread string management */
    retval=main_unix(argc, argv);
    unbind_ports();
    s_poll_free(fds);
    fds=NULL;
    str_stats();
    log_flush(LOG_MODE_ERROR);
    return retval;
}
Esempio n. 7
0
void *client_thread(void *arg)
{
	CLI *c = arg;

#ifdef DEBUG_STACK_SIZE
	stack_info(1);		
#endif
	client_main(c);
#ifdef DEBUG_STACK_SIZE
	stack_info(0);		
#endif
	str_stats();
	str_cleanup();
	
	return NULL;
}
Esempio n. 8
0
void *client_thread(void *arg) {
    CLI *c=arg;

#ifdef DEBUG_STACK_SIZE
    stack_info(1); /* initialize */
#endif
    client_main(c);
#ifdef DEBUG_STACK_SIZE
    stack_info(0); /* display computed value */
#endif
    str_stats();
    str_cleanup();
    /* s_log() is not allowed after str_cleanup() */
#if defined(USE_WIN32) && !defined(_WIN32_WCE)
    _endthread();
#endif
#ifdef USE_UCONTEXT
    s_poll_wait(NULL, 0, 0); /* wait on poll() */
#endif
    return NULL;
}