예제 #1
0
void radius_acct_shutdown(void)
{
    if (radius_mutex == NULL) /* haven't init'ed at all */
        return ;

    mutex_lock(radius_mutex);
    run_thread = 0;
    mutex_unlock(radius_mutex);

    gwthread_join_every(proxy_thread);

    dict_destroy(radius_table);
    dict_destroy(session_table);
    dict_destroy(client_table);

    mutex_destroy(radius_mutex);

    octstr_destroy(our_host);
    octstr_destroy(remote_host);
    octstr_destroy(secret_nas);
    octstr_destroy(secret_radius);
    octstr_destroy(unified_prefix);

    info(0, "RADIUS: accounting proxy stopped.");
}
예제 #2
0
파일: check_list.c 프로젝트: frese/mbuni
static void main_for_producer_and_consumer(void) {
	List *list;
	int i;
	Item *item;
	struct producer_info tab[NUM_PRODUCERS];
	long p, n, index;
	int errors;
	
	list = gwlist_create();
	init_received();
	
	for (i = 0; i < NUM_PRODUCERS; ++i) {
	    	tab[i].list = list;
		tab[i].start_index = i * NUM_ITEMS_PER_PRODUCER;
	    	gwlist_add_producer(list);
		tab[i].id = gwthread_create(producer, tab + i);
	}
	for (i = 0; i < NUM_CONSUMERS; ++i)
		gwthread_create(consumer, list);
	
    	gwthread_join_every(producer);
    	gwthread_join_every(consumer);

	while (gwlist_len(list) > 0) {
		item = gwlist_get(list, 0);
		gwlist_delete(list, 0, 1);
		warning(0, "main: %ld %ld %ld", (long) item->producer, 
				item->num, item->index);
	}
	
	errors = 0;
	for (p = 0; p < NUM_PRODUCERS; ++p) {
		for (n = 0; n < NUM_ITEMS_PER_PRODUCER; ++n) {
			index = p * NUM_ITEMS_PER_PRODUCER + n;
			if (!received[index]) {
				error(0, "Not received: producer=%ld "
				         "item=%ld index=%ld", 
					 tab[p].id, n, index);
				errors = 1;
			}
		}
	}
	
	if (errors)
		panic(0, "Not all messages were received.");
}
예제 #3
0
파일: wap_push_ota.c 프로젝트: armic/erpts
void wap_push_ota_shutdown(void)
{
    gw_assert(run_status == running);
    run_status = terminating;
    list_remove_producer(ota_queue);
    gwthread_join_every(main_thread);

    list_destroy(ota_queue, wap_event_destroy_item);
    bearerbox_address_destroy(bearerbox);
}
예제 #4
0
void wsp_push_client_shutdown(void)
{
    gw_assert(push_client_run_status == running);
    push_client_run_status = terminating;
    gwlist_remove_producer(push_client_queue);
    gwthread_join_every(main_thread);

    debug("wap.wsp", 0, "wsp_push_client_shutdown: %ld push client machines"
          "left", gwlist_len(push_client_machines));
    gwlist_destroy(push_client_machines, push_client_machine_destroy);
    gwlist_destroy(push_client_queue, wap_event_destroy_item);

    counter_destroy(push_client_machine_id_counter);
}
예제 #5
0
파일: bb_http.c 프로젝트: armic/erpts
void httpadmin_stop(void)
{
    http_close_all_ports();
    gwthread_join_every(httpadmin_run);
    octstr_destroy(ha_interface);    
    octstr_destroy(ha_password);
    octstr_destroy(ha_status_pw);
    octstr_destroy(ha_allow_ip);
    octstr_destroy(ha_deny_ip);
    ha_password = NULL;
    ha_status_pw = NULL;
    ha_allow_ip = NULL;
    ha_deny_ip = NULL;
}
예제 #6
0
void wsp_session_shutdown(void) {
	gw_assert(run_status == running);
	run_status = terminating;
	gwlist_remove_producer(queue);
	gwthread_join_every(main_thread);

	gwlist_destroy(queue, wap_event_destroy_item);

	debug("wap.wsp", 0, "WSP: %ld session machines left.",
		gwlist_len(session_machines));
	gwlist_destroy(session_machines, machine_destroy);

	counter_destroy(session_id_counter);
        wsp_strings_shutdown();
}
예제 #7
0
파일: wtp_init.c 프로젝트: markjeee/kannel
void wtp_initiator_shutdown(void) 
{
    gw_assert(initiator_run_status == running);
    initiator_run_status = terminating;
    gwlist_remove_producer(queue);
    gwthread_join_every(main_thread);

    debug("wap.wtp", 0, "wtp_initiator_shutdown: %ld init_machines left",
     	  gwlist_len(init_machines));
    gwlist_destroy(init_machines, init_machine_destroy);
    gwlist_destroy(queue, wap_event_destroy_item);

    counter_destroy(init_machine_id_counter);
    timers_shutdown();
}
예제 #8
0
void wtls_shutdown(void)
{
        /* Make sure that we're actually running; if so, then
           prepare for termination */
        gw_assert(wtls_run_status == running);
        wtls_run_status = terminating;
        gwlist_remove_producer(wtls_queue);
        gwthread_join_every(main_thread);

        /* Print out a friendly message stating that we're going to die */
        debug("wap.wtls", 0, "wtls_shutdown: %ld wtls machines left",
              gwlist_len(wtls_machines));

        /* And clean up nicely after ourselves */
        gwlist_destroy(wtls_machines, wtls_machine_destroy);
        gwlist_destroy(wtls_queue, wap_event_destroy_item);     
        counter_destroy(wtls_machine_id_counter);
}
예제 #9
0
파일: mms_queue.c 프로젝트: frese/mbuni
static void mms_queue_run(char *dir, 
			  int (*deliver)(MmsEnvelope *), 
			  double sleepsecs, int num_threads, int *rstop)
{
	int i, qstop = 0;
	List *stack = gwlist_create();
//	static struct Qthread_t *tlist;
	struct Qthread_t *tlist;
	
	debug("", 0, "mms_queue_run: %s", dir);
	
	max_live_exceeded_warning_issued = 0;
	
	number_of_threads = num_threads;
    gw_assert(num_threads>0);

	if (tlists == NULL)
		tlists = dict_create(10, NULL);
		
	Octstr *odir = octstr_create(dir);
	
	tlist = gw_malloc(num_threads*sizeof tlist[0]);
	dict_put(tlists, odir, tlist);
	gw_assert(tlist == dict_get(tlists,odir));
	
	debug("",0,"tlist allocated at addr %p", &tlist[0]);
	octstr_destroy(odir);
     
	for (i = 0; i<num_threads; i++) { /* Create threads for sending. */
		debug("",0,"%s tlist[%d] has addr: %p", dir, i, &tlist[i]);
		tlist[i].l = gwlist_create();
		gwlist_add_producer(tlist[i].l);
		tlist[i].deliver = deliver;
		gwthread_create((gwthread_func_t *)tdeliver, &tlist[i]);
	}

	i = 0;  /* For stepping through above array. */
	do { 
		Octstr *xdir = NULL;	  
		gwlist_append(stack, octstr_create("")); /* Put initial dir on there. */

		while (!*rstop && (xdir = gwlist_extract_first(stack)) != NULL) {
			int ret = run_dir(dir, octstr_get_cstr(xdir), tlist, num_threads, &i, stack);
			octstr_destroy(xdir);
			xdir = NULL;
			if (ret < 0) {		    
				if (ret <= -2)
					qstop = 1;
				goto qloop;
			}
		}

		octstr_destroy(xdir);
		if (*rstop) 
			break;
		qloop:
		gwthread_sleep(sleepsecs);
	} while (!qstop);

	/* We are out of the queue, time to go away. */
	for (i = 0; i<num_threads; i++)
		if (tlist[i].l)
			gwlist_remove_producer(tlist[i].l);
	gwthread_join_every((gwthread_func_t *)tdeliver); /* Wait for them all to terminate. */
  
	for (i = 0; i<num_threads; i++)
		if (tlist[i].l)
			gwlist_destroy(tlist[i].l,NULL); /* Final destroy if needed. */
			
	gw_free(tlist);
	gwlist_destroy(stack, (gwlist_item_destructor_t *)octstr_destroy);
	return;
}