schedule_job uses seconds to support time values larger than 49 days
added schedule_job_ms for ms resolution events
This commit is contained in:
@@ -904,7 +904,7 @@ static void update_checklist_state(private_connect_manager_t *this, check_list_t
|
||||
|
||||
callback_data_t *data = callback_data_create(this, checklist->connect_id);
|
||||
job_t *job = (job_t*)callback_job_create((callback_job_cb_t)initiator_finish, data, (callback_job_cleanup_t)callback_data_destroy, NULL);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, ME_WAIT_TO_FINISH);
|
||||
charon->scheduler->schedule_job_ms(charon->scheduler, job, ME_WAIT_TO_FINISH);
|
||||
checklist->is_finishing = TRUE;
|
||||
}
|
||||
|
||||
@@ -1002,7 +1002,7 @@ static void queue_retransmission(private_connect_manager_t *this, check_list_t *
|
||||
}
|
||||
DBG2(DBG_IKE, "scheduling retransmission %d of pair '%d' in %dms", retransmission, pair->id, rto);
|
||||
|
||||
charon->scheduler->schedule_job(charon->scheduler, (job_t*)job, rto);
|
||||
charon->scheduler->schedule_job_ms(charon->scheduler, (job_t*)job, rto);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1139,7 +1139,7 @@ static void schedule_checks(private_connect_manager_t *this, check_list_t *check
|
||||
{
|
||||
callback_data_t *data = callback_data_create(this, checklist->connect_id);
|
||||
checklist->sender = (job_t*)callback_job_create((callback_job_cb_t)sender, data, (callback_job_cleanup_t)callback_data_destroy, NULL);
|
||||
charon->scheduler->schedule_job(charon->scheduler, checklist->sender, time);
|
||||
charon->scheduler->schedule_job_ms(charon->scheduler, checklist->sender, time);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+11
-17
@@ -443,7 +443,7 @@ static void send_keepalive(private_ike_sa_t *this)
|
||||
}
|
||||
job = send_keepalive_job_create(this->ike_sa_id);
|
||||
charon->scheduler->schedule_job(charon->scheduler, (job_t*)job,
|
||||
(this->keepalive_interval - diff) * 1000);
|
||||
this->keepalive_interval - diff);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -542,7 +542,7 @@ static void set_condition(private_ike_sa_t *this, ike_condition_t condition,
|
||||
*/
|
||||
static status_t send_dpd(private_ike_sa_t *this)
|
||||
{
|
||||
send_dpd_job_t *job;
|
||||
job_t *job;
|
||||
time_t diff, delay;
|
||||
|
||||
delay = this->peer_cfg->get_dpd(this->peer_cfg);
|
||||
@@ -591,9 +591,8 @@ static status_t send_dpd(private_ike_sa_t *this)
|
||||
}
|
||||
}
|
||||
/* recheck in "interval" seconds */
|
||||
job = send_dpd_job_create(this->ike_sa_id);
|
||||
charon->scheduler->schedule_job(charon->scheduler, (job_t*)job,
|
||||
(delay - diff) * 1000);
|
||||
job = (job_t*)send_dpd_job_create(this->ike_sa_id);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, delay - diff);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -636,8 +635,7 @@ static void set_state(private_ike_sa_t *this, ike_sa_state_t state)
|
||||
{
|
||||
this->stats[STAT_REKEY] = t + this->stats[STAT_ESTABLISHED];
|
||||
job = (job_t*)rekey_ike_sa_job_create(this->ike_sa_id, FALSE);
|
||||
charon->scheduler->schedule_job(charon->scheduler,
|
||||
job, t * 1000);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, t);
|
||||
DBG1(DBG_IKE, "scheduling rekeying in %ds", t);
|
||||
}
|
||||
t = this->peer_cfg->get_reauth_time(this->peer_cfg);
|
||||
@@ -646,8 +644,7 @@ static void set_state(private_ike_sa_t *this, ike_sa_state_t state)
|
||||
{
|
||||
this->stats[STAT_REAUTH] = t + this->stats[STAT_ESTABLISHED];
|
||||
job = (job_t*)rekey_ike_sa_job_create(this->ike_sa_id, TRUE);
|
||||
charon->scheduler->schedule_job(charon->scheduler,
|
||||
job, t * 1000);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, t);
|
||||
DBG1(DBG_IKE, "scheduling reauthentication in %ds", t);
|
||||
}
|
||||
t = this->peer_cfg->get_over_time(this->peer_cfg);
|
||||
@@ -669,8 +666,7 @@ static void set_state(private_ike_sa_t *this, ike_sa_state_t state)
|
||||
this->stats[STAT_DELETE] += t;
|
||||
t = this->stats[STAT_DELETE] - this->stats[STAT_ESTABLISHED];
|
||||
job = (job_t*)delete_ike_sa_job_create(this->ike_sa_id, TRUE);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job,
|
||||
t * 1000);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, t);
|
||||
DBG1(DBG_IKE, "maximum IKE_SA lifetime %ds", t);
|
||||
}
|
||||
|
||||
@@ -1930,8 +1926,8 @@ static void set_auth_lifetime(private_ike_sa_t *this, u_int32_t lifetime)
|
||||
DBG1(DBG_IKE, "received AUTH_LIFETIME of %ds, scheduling reauthentication"
|
||||
" in %ds", lifetime, lifetime - reduction);
|
||||
charon->scheduler->schedule_job(charon->scheduler,
|
||||
(job_t*)rekey_ike_sa_job_create(this->ike_sa_id, TRUE),
|
||||
(lifetime - reduction) * 1000);
|
||||
(job_t*)rekey_ike_sa_job_create(this->ike_sa_id, TRUE),
|
||||
lifetime - reduction);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2077,11 +2073,9 @@ static status_t inherit(private_ike_sa_t *this, private_ike_sa_t *other)
|
||||
DBG1(DBG_IKE, "rescheduling reauthentication in %ds after rekeying, "
|
||||
"lifetime reduced to %ds", reauth, delete);
|
||||
charon->scheduler->schedule_job(charon->scheduler,
|
||||
(job_t*)rekey_ike_sa_job_create(this->ike_sa_id, TRUE),
|
||||
reauth * 1000);
|
||||
(job_t*)rekey_ike_sa_job_create(this->ike_sa_id, TRUE), reauth);
|
||||
charon->scheduler->schedule_job(charon->scheduler,
|
||||
(job_t*)delete_ike_sa_job_create(this->ike_sa_id, TRUE),
|
||||
delete * 1000);
|
||||
(job_t*)delete_ike_sa_job_create(this->ike_sa_id, TRUE), delete);
|
||||
}
|
||||
/* we have to initate here, there may be new tasks to handle */
|
||||
return this->task_manager->initiate(this->task_manager);
|
||||
|
||||
@@ -44,9 +44,9 @@ typedef struct ike_sa_t ike_sa_t;
|
||||
#include <config/auth_cfg.h>
|
||||
|
||||
/**
|
||||
* Timeout in milliseconds after that a half open IKE_SA gets deleted.
|
||||
* Timeout in seconds after that a half open IKE_SA gets deleted.
|
||||
*/
|
||||
#define HALF_OPEN_IKE_SA_TIMEOUT 30000
|
||||
#define HALF_OPEN_IKE_SA_TIMEOUT 30
|
||||
|
||||
/**
|
||||
* Interval to send keepalives when NATed, in seconds.
|
||||
|
||||
@@ -259,7 +259,7 @@ static status_t retransmit(private_task_manager_t *this, u_int32_t message_id)
|
||||
this->initiating.retransmitted++;
|
||||
job = (job_t*)retransmit_job_create(this->initiating.mid,
|
||||
this->ike_sa->get_id(this->ike_sa));
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, timeout);
|
||||
charon->scheduler->schedule_job_ms(charon->scheduler, job, timeout);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -772,7 +772,7 @@ static void handle_child_sa_failure(private_child_create_t *this,
|
||||
/* we delay the delete for 100ms, as the IKE_AUTH response must arrive
|
||||
* first */
|
||||
DBG1(DBG_IKE, "closing IKE_SA due CHILD_SA setup failure");
|
||||
charon->scheduler->schedule_job(charon->scheduler, (job_t*)
|
||||
charon->scheduler->schedule_job_ms(charon->scheduler, (job_t*)
|
||||
delete_ike_sa_job_create(this->ike_sa->get_id(this->ike_sa), TRUE),
|
||||
100);
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ static status_t process_i(private_child_rekey_t *this, message_t *message)
|
||||
DBG1(DBG_IKE, "CHILD_SA rekeying failed, "
|
||||
"trying again in %d seconds", retry);
|
||||
this->child_sa->set_state(this->child_sa, CHILD_INSTALLED);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, retry * 1000);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, retry);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ static status_t process_i(private_ike_rekey_t *this, message_t *message)
|
||||
DBG1(DBG_IKE, "IKE_SA rekeying failed, "
|
||||
"trying again in %d seconds", retry);
|
||||
this->ike_sa->set_state(this->ike_sa, IKE_ESTABLISHED);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, retry * 1000);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, retry);
|
||||
}
|
||||
return SUCCESS;
|
||||
case NEED_MORE:
|
||||
@@ -273,7 +273,7 @@ static status_t process_i(private_ike_rekey_t *this, message_t *message)
|
||||
/* peer should delete this SA. Add a timeout just in case. */
|
||||
job_t *job = (job_t*)delete_ike_sa_job_create(
|
||||
other->new_sa->get_id(other->new_sa), TRUE);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, 10000);
|
||||
charon->scheduler->schedule_job(charon->scheduler, job, 10);
|
||||
DBG1(DBG_IKE, "IKE_SA rekey collision won, deleting rekeyed IKE_SA");
|
||||
charon->ike_sa_manager->checkin(charon->ike_sa_manager, other->new_sa);
|
||||
other->new_sa = NULL;
|
||||
|
||||
Reference in New Issue
Block a user