aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/strongswan.conf.5.in3
-rw-r--r--src/libcharon/plugins/stroke/stroke_socket.c11
2 files changed, 12 insertions, 2 deletions
diff --git a/man/strongswan.conf.5.in b/man/strongswan.conf.5.in
index d48b9021a..12ae10ab1 100644
--- a/man/strongswan.conf.5.in
+++ b/man/strongswan.conf.5.in
@@ -466,6 +466,9 @@ Database URI for charons SQL plugin
.BR charon.plugins.sql.loglevel " [-1]"
Loglevel for logging to SQL database
.TP
+.BR charon.plugins.stroke.max_concurrent " [4]"
+Maximum number of stroke messages handled concurrently
+.TP
.BR charon.plugins.tnc-ifmap.device_name
Unique name of strongSwan as a PEP and/or PDP device
.TP
diff --git a/src/libcharon/plugins/stroke/stroke_socket.c b/src/libcharon/plugins/stroke/stroke_socket.c
index 019ec8a3b..43919b0e2 100644
--- a/src/libcharon/plugins/stroke/stroke_socket.c
+++ b/src/libcharon/plugins/stroke/stroke_socket.c
@@ -43,7 +43,7 @@
* To avoid clogging the thread pool with (blocking) jobs, we limit the number
* of concurrently handled stroke commands.
*/
-#define MAX_CONCURRENT 4
+#define MAX_CONCURRENT_DEFAULT 4
typedef struct stroke_job_context_t stroke_job_context_t;
typedef struct private_stroke_socket_t private_stroke_socket_t;
@@ -94,6 +94,11 @@ struct private_stroke_socket_t {
u_int handling;
/**
+ * the maximum number of concurrently handled commands
+ */
+ u_int max_concurrent;
+
+ /**
* configuration backend
*/
stroke_config_t *config;
@@ -662,7 +667,7 @@ static job_requeue_t handle(private_stroke_socket_t *this)
thread_cleanup_push((thread_cleanup_t)this->mutex->unlock, this->mutex);
oldstate = thread_cancelability(TRUE);
while (this->commands->get_count(this->commands) == 0 ||
- this->handling >= MAX_CONCURRENT)
+ this->handling >= this->max_concurrent)
{
this->condvar->wait(this->condvar, this->mutex);
}
@@ -803,6 +808,8 @@ stroke_socket_t *stroke_socket_create()
this->mutex = mutex_create(MUTEX_TYPE_DEFAULT);
this->condvar = condvar_create(CONDVAR_TYPE_DEFAULT);
this->commands = linked_list_create();
+ this->max_concurrent = lib->settings->get_int(lib->settings,
+ "charon.plugins.stroke.max_concurrent", MAX_CONCURRENT_DEFAULT);
lib->credmgr->add_set(lib->credmgr, &this->ca->set);
lib->credmgr->add_set(lib->credmgr, &this->cred->set);