Use job priorities in process_message job based on exchange types

This commit is contained in:
Martin Willi
2011-05-16 15:24:13 +02:00
parent 68f56418cd
commit ea69c70d0e
@@ -87,7 +87,22 @@ METHOD(job_t, execute, void,
METHOD(job_t, get_priority, job_priority_t,
private_process_message_job_t *this)
{
return JOB_PRIO_MEDIUM;
switch (this->message->get_exchange_type(this->message))
{
case IKE_AUTH:
/* IKE auth is rather expensive and often blocking, low priority */
return JOB_PRIO_LOW;
case INFORMATIONAL:
/* INFORMATIONALs are inexpensive, for DPD we should have low
* reaction times */
return JOB_PRIO_HIGH;
case IKE_SA_INIT:
case CREATE_CHILD_SA:
default:
/* IKE_SA_INIT is expensive, but we will drop them in the receiver
* if we are overloaded */
return JOB_PRIO_MEDIUM;
}
}
/*