summaryrefslogtreecommitdiff
path: root/src/charon/processing/jobs
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2008-02-08 18:04:42 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2008-02-08 18:04:42 +0000
commit73ac0ec24bdf4bf3d82850b80dba4905c3e4f884 (patch)
treef36bb7f5967d4aaeb6621860639df312c1dcad7c /src/charon/processing/jobs
parent61c73fef76f2fb057e3dde2fc4d32e933f22bc74 (diff)
downloadvyos-strongswan-73ac0ec24bdf4bf3d82850b80dba4905c3e4f884.tar.gz
vyos-strongswan-73ac0ec24bdf4bf3d82850b80dba4905c3e4f884.zip
- Updated to new upstream release.
- Updated ja.po.
Diffstat (limited to 'src/charon/processing/jobs')
-rw-r--r--src/charon/processing/jobs/callback_job.c14
-rw-r--r--src/charon/processing/jobs/initiate_mediation_job.c32
-rw-r--r--src/charon/processing/jobs/mediation_job.c6
-rw-r--r--src/charon/processing/jobs/process_message_job.c7
4 files changed, 31 insertions, 28 deletions
diff --git a/src/charon/processing/jobs/callback_job.c b/src/charon/processing/jobs/callback_job.c
index 6f534e0f7..53297916e 100644
--- a/src/charon/processing/jobs/callback_job.c
+++ b/src/charon/processing/jobs/callback_job.c
@@ -121,12 +121,7 @@ static void cancel(private_callback_job_t *this)
{
pthread_t thread;
- /* wait until thread has started */
pthread_mutex_lock(&this->mutex);
- while (this->thread == 0)
- {
- pthread_cond_wait(&this->condvar, &this->mutex);
- }
thread = this->thread;
/* terminate its children */
@@ -134,8 +129,11 @@ static void cancel(private_callback_job_t *this)
pthread_mutex_unlock(&this->mutex);
/* terminate thread */
- pthread_cancel(thread);
- pthread_join(thread, NULL);
+ if (thread)
+ {
+ pthread_cancel(thread);
+ pthread_join(thread, NULL);
+ }
}
/**
@@ -159,6 +157,7 @@ static void execute(private_callback_job_t *this)
continue;
case JOB_REQUEUE_FAIR:
{
+ this->thread = 0;
charon->processor->queue_job(charon->processor,
&this->public.job_interface);
break;
@@ -166,6 +165,7 @@ static void execute(private_callback_job_t *this)
case JOB_REQUEUE_NONE:
default:
{
+ this->thread = 0;
cleanup = TRUE;
break;
}
diff --git a/src/charon/processing/jobs/initiate_mediation_job.c b/src/charon/processing/jobs/initiate_mediation_job.c
index d78f8a202..b8d516e22 100644
--- a/src/charon/processing/jobs/initiate_mediation_job.c
+++ b/src/charon/processing/jobs/initiate_mediation_job.c
@@ -73,7 +73,7 @@ static bool initiate_callback(private_initiate_mediation_job_t *this, signal_t s
{
if (signal == CHILD_UP_SUCCESS)
{
- // mediation connection is up
+ /* mediation connection is up */
this->mediation_sa_id = ike_sa->get_id(ike_sa);
this->mediation_sa_id = this->mediation_sa_id->clone(this->mediation_sa_id);
return FALSE;
@@ -85,7 +85,7 @@ static bool initiate_callback(private_initiate_mediation_job_t *this, signal_t s
* Implementation of job_t.execute.
*/
static void initiate(private_initiate_mediation_job_t *this)
-{//FIXME: check the logging
+{ /* FIXME: check the logging */
ike_sa_t *mediated_sa, *mediation_sa;
peer_cfg_t *mediated_cfg, *mediation_cfg;
@@ -94,7 +94,8 @@ static void initiate(private_initiate_mediation_job_t *this)
if (mediated_sa)
{
mediated_cfg = mediated_sa->get_peer_cfg(mediated_sa);
- mediated_cfg->get_ref(mediated_cfg); // get_peer_cfg returns an internal object
+ /* get_peer_cfg returns an internal object */
+ mediated_cfg->get_ref(mediated_cfg);
charon->ike_sa_manager->checkin(charon->ike_sa_manager, mediated_sa);
@@ -107,18 +108,19 @@ static void initiate(private_initiate_mediation_job_t *this)
{
mediated_cfg->destroy(mediated_cfg);
mediation_cfg->destroy(mediation_cfg);
- charon->bus->set_sa(charon->bus, mediated_sa); // this pointer should still be valid
+ /* this pointer should still be valid */
+ charon->bus->set_sa(charon->bus, mediated_sa);
DBG1(DBG_IKE, "mediation with the same peer is already in progress, queued");
destroy(this);
return;
}
-
- mediation_cfg->get_ref(mediation_cfg); // we need an additional reference because initiate consumes one
+ /* we need an additional reference because initiate consumes one */
+ mediation_cfg->get_ref(mediation_cfg);
- // this function call blocks until the connection is up or failed
- // we do not check the status, but NEED_MORE would be returned on success
- // because the registered callback returns FALSE then
- // this->mediation_sa_id is set in the callback
+ /* this function call blocks until the connection is up or failed
+ * we do not check the status, but NEED_MORE would be returned on success
+ * because the registered callback returns FALSE then
+ * this->mediation_sa_id is set in the callback */
charon->interfaces->initiate(charon->interfaces,
mediation_cfg, NULL, (interface_manager_cb_t)initiate_callback, this);
if (!this->mediation_sa_id)
@@ -127,7 +129,7 @@ static void initiate(private_initiate_mediation_job_t *this)
mediation_cfg->get_name(mediation_cfg));
mediation_cfg->destroy(mediation_cfg);
mediated_cfg->destroy(mediated_cfg);
- charon->bus->set_sa(charon->bus, mediated_sa); // this pointer should still be valid
+ charon->bus->set_sa(charon->bus, mediated_sa);
SIG(IKE_UP_FAILED, "mediation failed");
destroy(this);
return;
@@ -146,7 +148,7 @@ static void initiate(private_initiate_mediation_job_t *this)
mediated_cfg->destroy(mediated_cfg);
charon->ike_sa_manager->checkin_and_destroy(charon->ike_sa_manager, mediation_sa);
- charon->bus->set_sa(charon->bus, mediated_sa); // this pointer should still be valid
+ charon->bus->set_sa(charon->bus, mediated_sa);
SIG(IKE_UP_FAILED, "mediation failed");
destroy(this);
return;
@@ -164,7 +166,7 @@ static void initiate(private_initiate_mediation_job_t *this)
* Implementation of job_t.execute.
*/
static void reinitiate(private_initiate_mediation_job_t *this)
-{//FIXME: check the logging
+{ /* FIXME: check the logging */
ike_sa_t *mediated_sa, *mediation_sa;
peer_cfg_t *mediated_cfg;
@@ -173,7 +175,7 @@ static void reinitiate(private_initiate_mediation_job_t *this)
if (mediated_sa)
{
mediated_cfg = mediated_sa->get_peer_cfg(mediated_sa);
- mediated_cfg->get_ref(mediated_cfg); // get_peer_cfg returns an internal object
+ mediated_cfg->get_ref(mediated_cfg);
charon->ike_sa_manager->checkin(charon->ike_sa_manager, mediated_sa);
mediation_sa = charon->ike_sa_manager->checkout(charon->ike_sa_manager,
@@ -187,7 +189,7 @@ static void reinitiate(private_initiate_mediation_job_t *this)
mediated_cfg->destroy(mediated_cfg);
charon->ike_sa_manager->checkin_and_destroy(charon->ike_sa_manager, mediation_sa);
- charon->bus->set_sa(charon->bus, mediated_sa); // this pointer should still be valid
+ charon->bus->set_sa(charon->bus, mediated_sa);
SIG(IKE_UP_FAILED, "mediation failed");
destroy(this);
return;
diff --git a/src/charon/processing/jobs/mediation_job.c b/src/charon/processing/jobs/mediation_job.c
index 6f5f74372..3b9d363d7 100644
--- a/src/charon/processing/jobs/mediation_job.c
+++ b/src/charon/processing/jobs/mediation_job.c
@@ -104,7 +104,7 @@ static void execute(private_mediation_job_t *this)
{
if (this->callback)
{
- // send callback to a peer
+ /* send callback to a peer */
if (target_sa->callback(target_sa, this->source) != SUCCESS)
{
DBG1(DBG_JOB, "callback for '%D' to '%D' failed",
@@ -116,14 +116,14 @@ static void execute(private_mediation_job_t *this)
}
else
{
- // normal mediation between two peers
+ /* normal mediation between two peers */
if (target_sa->relay(target_sa, this->source, this->session_id,
this->session_key, this->endpoints, this->response) != SUCCESS)
{
DBG1(DBG_JOB, "mediation between '%D' and '%D' failed",
this->source, this->target);
charon->ike_sa_manager->checkin(charon->ike_sa_manager, target_sa);
- // FIXME: notify the initiator
+ /* FIXME: notify the initiator */
destroy(this);
return;
}
diff --git a/src/charon/processing/jobs/process_message_job.c b/src/charon/processing/jobs/process_message_job.c
index ec2e7735d..91e7a80bf 100644
--- a/src/charon/processing/jobs/process_message_job.c
+++ b/src/charon/processing/jobs/process_message_job.c
@@ -60,12 +60,13 @@ static void execute(private_process_message_job_t *this)
ike_sa_t *ike_sa;
#ifdef P2P
- // if this is an unencrypted INFORMATIONAL exchange it is likely a
- // connectivity check
+ /* if this is an unencrypted INFORMATIONAL exchange it is likely a
+ * connectivity check. */
if (this->message->get_exchange_type(this->message) == INFORMATIONAL &&
this->message->get_first_payload_type(this->message) != ENCRYPTED)
{
- // theoretically this could also be an error message see RFC 4306, section 1.5.
+ /* theoretically this could also be an error message
+ * see RFC 4306, section 1.5. */
DBG1(DBG_NET, "received unencrypted informational: from %#H to %#H",
this->message->get_source(this->message),
this->message->get_destination(this->message));