From 25c41f4df7079b64ba53184e47edbc012ae96123 Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Sun, 4 Dec 2005 11:46:58 +0000 Subject: - logging cleanup - pid re-replaced with thread_ids, since nptl does not distinguish pids between threads --- Source/charon/daemon.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'Source/charon/daemon.c') diff --git a/Source/charon/daemon.c b/Source/charon/daemon.c index be9900757..d015a955d 100644 --- a/Source/charon/daemon.c +++ b/Source/charon/daemon.c @@ -23,7 +23,6 @@ #include #include #include -#include #include "daemon.h" @@ -58,9 +57,9 @@ struct private_daemon_t { sigset_t signal_set; /** - * pid of main-thread + * thread_id of main-thread */ - pid_t main_thread_pid; + pthread_t main_thread_id; /** * main loop @@ -135,7 +134,7 @@ static void kill_daemon(private_daemon_t *this, char *reason) { /* we send SIGTERM, so the daemon can cleanly shut down */ this->logger->log(this->logger, ERROR, "Killing daemon: %s", reason); - if (this->main_thread_pid == getpid()) + if (this->main_thread_id == pthread_self()) { /* initialization failed, terminate daemon */ this->destroy(this); @@ -156,11 +155,11 @@ static void kill_daemon(private_daemon_t *this, char *reason) static void build_test_jobs(private_daemon_t *this) { int i; - for(i = 0; i<1; i++) + for(i = 0; i<100; i++) { initiate_ike_sa_job_t *initiate_job; initiate_job = initiate_ike_sa_job_create("localhost"); - this->public.job_queue->add(this->public.job_queue, (job_t*)initiate_job); + this->public.event_queue->add_relative(this->public.event_queue, (job_t*)initiate_job, i * 5000); } } @@ -179,7 +178,7 @@ static void initialize(private_daemon_t *this) this->public.sender = sender_create(); this->public.receiver = receiver_create(); this->public.scheduler = scheduler_create(); - this->public.prime_pool = prime_pool_create(0); + this->public.prime_pool = prime_pool_create(10); this->public.thread_pool = thread_pool_create(NUMBER_OF_WORKING_THREADS); } @@ -271,7 +270,7 @@ private_daemon_t *daemon_create() this->public.scheduler = NULL; this->public.thread_pool = NULL; - this->main_thread_pid = getpid(); + this->main_thread_id = pthread_self(); /* setup signal handling */ sigemptyset(&(this->signal_set)); -- cgit v1.2.3