Move processor_t (thread-pool) to libhydra.
This commit is contained in:
@@ -47,7 +47,6 @@ network/packet.c network/packet.h \
|
||||
network/receiver.c network/receiver.h \
|
||||
network/sender.c network/sender.h \
|
||||
network/socket_manager.c network/socket_manager.h network/socket.h \
|
||||
processing/jobs/job.h \
|
||||
processing/jobs/acquire_job.c processing/jobs/acquire_job.h \
|
||||
processing/jobs/callback_job.c processing/jobs/callback_job.h \
|
||||
processing/jobs/delete_child_sa_job.c processing/jobs/delete_child_sa_job.h \
|
||||
@@ -63,7 +62,6 @@ processing/jobs/roam_job.c processing/jobs/roam_job.h \
|
||||
processing/jobs/update_sa_job.c processing/jobs/update_sa_job.h \
|
||||
processing/jobs/inactivity_job.c processing/jobs/inactivity_job.h \
|
||||
processing/scheduler.c processing/scheduler.h \
|
||||
processing/processor.c processing/processor.h \
|
||||
sa/authenticators/authenticator.c sa/authenticators/authenticator.h \
|
||||
sa/authenticators/eap_authenticator.c sa/authenticators/eap_authenticator.h \
|
||||
sa/authenticators/eap/eap_method.c sa/authenticators/eap/eap_method.h \
|
||||
|
||||
@@ -45,7 +45,6 @@ network/packet.c network/packet.h \
|
||||
network/receiver.c network/receiver.h \
|
||||
network/sender.c network/sender.h \
|
||||
network/socket_manager.c network/socket_manager.h network/socket.h \
|
||||
processing/jobs/job.h \
|
||||
processing/jobs/acquire_job.c processing/jobs/acquire_job.h \
|
||||
processing/jobs/callback_job.c processing/jobs/callback_job.h \
|
||||
processing/jobs/delete_child_sa_job.c processing/jobs/delete_child_sa_job.h \
|
||||
@@ -61,7 +60,6 @@ processing/jobs/roam_job.c processing/jobs/roam_job.h \
|
||||
processing/jobs/update_sa_job.c processing/jobs/update_sa_job.h \
|
||||
processing/jobs/inactivity_job.c processing/jobs/inactivity_job.h \
|
||||
processing/scheduler.c processing/scheduler.h \
|
||||
processing/processor.c processing/processor.h \
|
||||
sa/authenticators/authenticator.c sa/authenticators/authenticator.h \
|
||||
sa/authenticators/eap_authenticator.c sa/authenticators/eap_authenticator.h \
|
||||
sa/authenticators/eap/eap_method.c sa/authenticators/eap/eap_method.h \
|
||||
|
||||
@@ -94,10 +94,8 @@ static void dbg_bus(debug_t group, level_t level, char *fmt, ...)
|
||||
static void destroy(private_daemon_t *this)
|
||||
{
|
||||
/* terminate all idle threads */
|
||||
if (this->public.processor)
|
||||
{
|
||||
this->public.processor->set_threads(this->public.processor, 0);
|
||||
}
|
||||
hydra->processor->set_threads(hydra->processor, 0);
|
||||
|
||||
/* close all IKE_SAs */
|
||||
if (this->public.ike_sa_manager)
|
||||
{
|
||||
@@ -123,8 +121,6 @@ static void destroy(private_daemon_t *this)
|
||||
#endif /* ME */
|
||||
DESTROY_IF(this->public.backends);
|
||||
DESTROY_IF(this->public.socket);
|
||||
/* wait until all threads are gone */
|
||||
DESTROY_IF(this->public.processor);
|
||||
|
||||
/* rehook library logging, shutdown logging */
|
||||
dbg = dbg_old;
|
||||
@@ -176,7 +172,7 @@ METHOD(daemon_t, start, void,
|
||||
private_daemon_t *this)
|
||||
{
|
||||
/* start the engine, go multithreaded */
|
||||
charon->processor->set_threads(charon->processor,
|
||||
hydra->processor->set_threads(hydra->processor,
|
||||
lib->settings->get_int(lib->settings, "charon.threads",
|
||||
DEFAULT_THREADS));
|
||||
}
|
||||
@@ -361,7 +357,6 @@ METHOD(daemon_t, initialize, bool,
|
||||
}
|
||||
|
||||
/* load secrets, ca certificates and crls */
|
||||
this->public.processor = processor_create();
|
||||
this->public.scheduler = scheduler_create();
|
||||
this->public.controller = controller_create();
|
||||
this->public.eap = eap_manager_create();
|
||||
|
||||
@@ -141,7 +141,6 @@ typedef struct daemon_t daemon_t;
|
||||
#include <network/receiver.h>
|
||||
#include <network/socket_manager.h>
|
||||
#include <processing/scheduler.h>
|
||||
#include <processing/processor.h>
|
||||
#include <kernel/kernel_interface.h>
|
||||
#include <control/controller.h>
|
||||
#include <bus/bus.h>
|
||||
@@ -213,11 +212,6 @@ struct daemon_t {
|
||||
*/
|
||||
scheduler_t *scheduler;
|
||||
|
||||
/**
|
||||
* Job processing using a thread pool.
|
||||
*/
|
||||
processor_t *processor;
|
||||
|
||||
/**
|
||||
* The signaling bus.
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,9 @@ hydra.c hydra.h \
|
||||
attributes/attributes.c attributes/attributes.h \
|
||||
attributes/attribute_provider.h attributes/attribute_handler.h \
|
||||
attributes/attribute_manager.c attributes/attribute_manager.h \
|
||||
attributes/mem_pool.c attributes/mem_pool.h
|
||||
attributes/mem_pool.c attributes/mem_pool.h \
|
||||
processing/jobs/job.h \
|
||||
processing/processor.c processing/processor.h
|
||||
|
||||
# adding the plugin source files
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ hydra.c hydra.h \
|
||||
attributes/attributes.c attributes/attributes.h \
|
||||
attributes/attribute_provider.h attributes/attribute_handler.h \
|
||||
attributes/attribute_manager.c attributes/attribute_manager.h \
|
||||
attributes/mem_pool.c attributes/mem_pool.h
|
||||
attributes/mem_pool.c attributes/mem_pool.h \
|
||||
processing/jobs/job.h \
|
||||
processing/processor.c processing/processor.h
|
||||
|
||||
libhydra_la_LIBADD =
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ void libhydra_deinit()
|
||||
{
|
||||
private_hydra_t *this = (private_hydra_t*)hydra;
|
||||
this->public.attributes->destroy(this->public.attributes);
|
||||
this->public.processor->destroy(this->public.processor);
|
||||
free((void*)this->public.daemon);
|
||||
free(this);
|
||||
hydra = NULL;
|
||||
@@ -57,6 +58,7 @@ bool libhydra_init(const char *daemon)
|
||||
INIT(this,
|
||||
.public = {
|
||||
.attributes = attribute_manager_create(),
|
||||
.processor = processor_create(),
|
||||
.daemon = strdup(daemon ?: "libhydra"),
|
||||
},
|
||||
);
|
||||
|
||||
@@ -22,6 +22,12 @@
|
||||
* @defgroup hplugins plugins
|
||||
* @ingroup libhydra
|
||||
*
|
||||
* @defgroup processing processing
|
||||
* @ingroup libhydra
|
||||
*
|
||||
* @defgroup jobs jobs
|
||||
* @ingroup processing
|
||||
*
|
||||
* @addtogroup libhydra
|
||||
* @{
|
||||
*/
|
||||
@@ -32,6 +38,7 @@
|
||||
typedef struct hydra_t hydra_t;
|
||||
|
||||
#include <attributes/attribute_manager.h>
|
||||
#include <processing/processor.h>
|
||||
|
||||
#include <library.h>
|
||||
|
||||
@@ -45,6 +52,11 @@ struct hydra_t {
|
||||
*/
|
||||
attribute_manager_t *attributes;
|
||||
|
||||
/**
|
||||
* process jobs using a thread pool
|
||||
*/
|
||||
processor_t *processor;
|
||||
|
||||
/**
|
||||
* name of the daemon that initialized the library
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "processor.h"
|
||||
|
||||
#include <daemon.h>
|
||||
#include <threading/thread.h>
|
||||
#include <threading/condvar.h>
|
||||
#include <threading/mutex.h>
|
||||
Reference in New Issue
Block a user