From ea69c70d0ec8627a8637ab61ced4f966cf0b22fc Mon Sep 17 00:00:00 2001 From: Martin Willi Date: Mon, 2 May 2011 13:56:17 +0200 Subject: [PATCH] Use job priorities in process_message job based on exchange types --- .../processing/jobs/process_message_job.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/libcharon/processing/jobs/process_message_job.c b/src/libcharon/processing/jobs/process_message_job.c index c5c5f07c9..a4924d001 100644 --- a/src/libcharon/processing/jobs/process_message_job.c +++ b/src/libcharon/processing/jobs/process_message_job.c @@ -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; + } } /*