Refer to scheduler and processor via lib and not hydra.

This commit is contained in:
Tobias Brunner
2010-09-02 19:04:18 +02:00
parent e18556e9e9
commit bb381e26c6
37 changed files with 79 additions and 103 deletions
@@ -20,7 +20,6 @@
#include "android_service.h"
#include <hydra.h>
#include <daemon.h>
#include <threading/thread.h>
#include <processing/jobs/callback_job.h>
@@ -142,7 +141,7 @@ METHOD(listener_t, child_updown, bool,
* callback, but from a different thread. we also delay it to avoid
* a race condition during a regular shutdown */
job = callback_job_create(shutdown_callback, NULL, NULL, NULL);
hydra->scheduler->schedule_job(hydra->scheduler, (job_t*)job, 1);
lib->scheduler->schedule_job(lib->scheduler, (job_t*)job, 1);
return FALSE;
}
}
@@ -379,7 +378,7 @@ android_service_t *android_service_create(android_creds_t *creds)
charon->bus->add_listener(charon->bus, &this->public.listener);
this->job = callback_job_create((callback_job_cb_t)initiate, this,
NULL, NULL);
hydra->processor->queue_job(hydra->processor, (job_t*)this->job);
lib->processor->queue_job(lib->processor, (job_t*)this->job);
return &this->public;
}
+1 -1
View File
@@ -752,7 +752,7 @@ dhcp_socket_t *dhcp_socket_create()
this->job = callback_job_create((callback_job_cb_t)receive_dhcp,
this, NULL, NULL);
hydra->processor->queue_job(hydra->processor, (job_t*)this->job);
lib->processor->queue_job(lib->processor, (job_t*)this->job);
return &this->public;
}
+1 -2
View File
@@ -23,7 +23,6 @@
#include <linux/filter.h>
#include <sys/ioctl.h>
#include <hydra.h>
#include <daemon.h>
#include <threading/thread.h>
#include <processing/jobs/callback_job.h>
@@ -192,7 +191,7 @@ farp_spoofer_t *farp_spoofer_create(farp_listener_t *listener)
this->job = callback_job_create((callback_job_cb_t)receive_arp,
this, NULL, NULL);
hydra->processor->queue_job(hydra->processor, (job_t*)this->job);
lib->processor->queue_job(lib->processor, (job_t*)this->job);
return &this->public;
}
+1 -2
View File
@@ -23,7 +23,6 @@
#include <errno.h>
#include <pthread.h>
#include <hydra.h>
#include <processing/jobs/callback_job.h>
#define HA_FIFO IPSEC_PIDDIR "/charon.ha"
@@ -135,7 +134,7 @@ ha_ctl_t *ha_ctl_create(ha_segments_t *segments, ha_cache_t *cache)
this->job = callback_job_create((callback_job_cb_t)dispatch_fifo,
this, NULL, NULL);
hydra->processor->queue_job(hydra->processor, (job_t*)this->job);
lib->processor->queue_job(lib->processor, (job_t*)this->job);
return &this->public;
}
+1 -2
View File
@@ -15,7 +15,6 @@
#include "ha_dispatcher.h"
#include <hydra.h>
#include <daemon.h>
#include <processing/jobs/callback_job.h>
@@ -870,7 +869,7 @@ ha_dispatcher_t *ha_dispatcher_create(ha_socket_t *socket,
);
this->job = callback_job_create((callback_job_cb_t)dispatch,
this, NULL, NULL);
hydra->processor->queue_job(hydra->processor, (job_t*)this->job);
lib->processor->queue_job(lib->processor, (job_t*)this->job);
return &this->public;
}
+2 -3
View File
@@ -17,7 +17,6 @@
#include <pthread.h>
#include <hydra.h>
#include <threading/mutex.h>
#include <threading/condvar.h>
#include <utils/linked_list.h>
@@ -284,7 +283,7 @@ static void start_watchdog(private_ha_segments_t *this)
{
this->job = callback_job_create((callback_job_cb_t)watchdog,
this, NULL, NULL);
hydra->processor->queue_job(hydra->processor, (job_t*)this->job);
lib->processor->queue_job(lib->processor, (job_t*)this->job);
}
METHOD(ha_segments_t, handle_status, void,
@@ -346,7 +345,7 @@ static job_requeue_t send_status(private_ha_segments_t *this)
message->destroy(message);
/* schedule next invocation */
hydra->scheduler->schedule_job_ms(hydra->scheduler, (job_t*)
lib->scheduler->schedule_job_ms(lib->scheduler, (job_t*)
callback_job_create((callback_job_cb_t)
send_status, this, NULL, NULL),
this->heartbeat_delay);
+1 -2
View File
@@ -22,7 +22,6 @@
#include <unistd.h>
#include <pthread.h>
#include <hydra.h>
#include <daemon.h>
#include <utils/host.h>
#include <processing/jobs/callback_job.h>
@@ -108,7 +107,7 @@ METHOD(ha_socket_t, push, void,
job = callback_job_create((callback_job_cb_t)send_message,
data, (void*)job_data_destroy, NULL);
hydra->processor->queue_job(hydra->processor, (job_t*)job);
lib->processor->queue_job(lib->processor, (job_t*)job);
return;
}
DBG1(DBG_CFG, "pushing HA message failed: %s", strerror(errno));
@@ -17,7 +17,6 @@
#include <signal.h>
#include <hydra.h>
#include <daemon.h>
#include <processing/jobs/delete_ike_sa_job.h>
@@ -60,7 +59,7 @@ static bool ike_state_change(private_load_tester_listener_t *this,
if (this->delete_after_established)
{
hydra->processor->queue_job(hydra->processor,
lib->processor->queue_job(lib->processor,
(job_t*)delete_ike_sa_job_create(id, TRUE));
}
@@ -222,7 +222,7 @@ plugin_t *load_tester_plugin_create()
this->running = 0;
for (i = 0; i < this->initiators; i++)
{
hydra->processor->queue_job(hydra->processor,
lib->processor->queue_job(lib->processor,
(job_t*)callback_job_create((callback_job_cb_t)do_load_test,
this, NULL, NULL));
}
+1 -2
View File
@@ -18,7 +18,6 @@
#include "medcli_config.h"
#include <hydra.h>
#include <daemon.h>
#include <processing/jobs/callback_job.h>
@@ -365,7 +364,7 @@ static void schedule_autoinit(private_medcli_config_t *this)
if (peer_cfg)
{
/* schedule asynchronous initiation job */
hydra->processor->queue_job(hydra->processor,
lib->processor->queue_job(lib->processor,
(job_t*)callback_job_create(
(callback_job_cb_t)initiate_config,
peer_cfg, (void*)peer_cfg->destroy, NULL));
+1 -1
View File
@@ -122,7 +122,7 @@ plugin_t *nm_plugin_create()
/* bypass file permissions to read from users ssh-agent */
charon->keep_cap(charon, CAP_DAC_OVERRIDE);
hydra->processor->queue_job(hydra->processor,
lib->processor->queue_job(lib->processor,
(job_t*)callback_job_create((callback_job_cb_t)run, this, NULL, NULL));
return &this->public.plugin;
+2 -3
View File
@@ -28,7 +28,6 @@
#include <libxml/xmlwriter.h>
#include <library.h>
#include <hydra.h>
#include <daemon.h>
#include <threading/thread.h>
#include <processing/jobs/callback_job.h>
@@ -703,7 +702,7 @@ static job_requeue_t dispatch(private_smp_t *this)
fdp = malloc_thing(int);
*fdp = fd;
job = callback_job_create((callback_job_cb_t)process, fdp, free, this->job);
hydra->processor->queue_job(hydra->processor, (job_t*)job);
lib->processor->queue_job(lib->processor, (job_t*)job);
return JOB_REQUEUE_DIRECT;
}
@@ -762,7 +761,7 @@ plugin_t *smp_plugin_create()
}
this->job = callback_job_create((callback_job_cb_t)dispatch, this, NULL, NULL);
hydra->processor->queue_job(hydra->processor, (job_t*)this->job);
lib->processor->queue_job(lib->processor, (job_t*)this->job);
return &this->public.plugin;
}
@@ -15,7 +15,6 @@
#include "stroke_control.h"
#include <hydra.h>
#include <daemon.h>
#include <processing/jobs/delete_ike_sa_job.h>
@@ -355,7 +354,7 @@ static void terminate_srcip(private_stroke_control_t *this,
}
/* schedule delete asynchronously */
hydra->processor->queue_job(hydra->processor, (job_t*)
lib->processor->queue_job(lib->processor, (job_t*)
delete_ike_sa_job_create(ike_sa->get_id(ike_sa), TRUE));
}
enumerator->destroy(enumerator);
+4 -4
View File
@@ -423,12 +423,12 @@ static void status(private_stroke_list_t *this, stroke_msg_t *msg, FILE *out, bo
}
#endif /* HAVE_MALLINFO */
fprintf(out, " worker threads: %d idle of %d,",
hydra->processor->get_idle_threads(hydra->processor),
hydra->processor->get_total_threads(hydra->processor));
lib->processor->get_idle_threads(lib->processor),
lib->processor->get_total_threads(lib->processor));
fprintf(out, " job queue load: %d,",
hydra->processor->get_job_load(hydra->processor));
lib->processor->get_job_load(lib->processor));
fprintf(out, " scheduled events: %d\n",
hydra->scheduler->get_job_load(hydra->scheduler));
lib->scheduler->get_job_load(lib->scheduler));
fprintf(out, " loaded plugins: ");
enumerator = lib->plugins->create_plugin_enumerator(lib->plugins);
while (enumerator->enumerate(enumerator, &plugin))
+2 -2
View File
@@ -586,7 +586,7 @@ static job_requeue_t receive(private_stroke_socket_t *this)
ctx->this = this;
job = callback_job_create((callback_job_cb_t)process,
ctx, (void*)stroke_job_context_destroy, this->job);
hydra->processor->queue_job(hydra->processor, (job_t*)job);
lib->processor->queue_job(lib->processor, (job_t*)job);
return JOB_REQUEUE_FAIR;
}
@@ -684,7 +684,7 @@ stroke_socket_t *stroke_socket_create()
this->job = callback_job_create((callback_job_cb_t)receive,
this, NULL, NULL);
hydra->processor->queue_job(hydra->processor, (job_t*)this->job);
lib->processor->queue_job(lib->processor, (job_t*)this->job);
return &this->public;
}
+1 -2
View File
@@ -24,7 +24,6 @@
#include "uci_control.h"
#include <hydra.h>
#include <daemon.h>
#include <threading/thread.h>
#include <processing/jobs/callback_job.h>
@@ -295,7 +294,7 @@ uci_control_t *uci_control_create()
{
this->job = callback_job_create((callback_job_cb_t)receive,
this, NULL, NULL);
hydra->processor->queue_job(hydra->processor, (job_t*)this->job);
lib->processor->queue_job(lib->processor, (job_t*)this->job);
}
return &this->public;
}