aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/load_tester/load_tester_control.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2012-10-19 14:54:23 +0200
committerMartin Willi <martin@revosec.ch>2012-11-29 10:22:51 +0100
commitfdd94fc846ca2057ab2994e92e712da63f760580 (patch)
tree0279bb6364ed75c6b7f6e77fe97dbcaa1defa268 /src/libcharon/plugins/load_tester/load_tester_control.c
parentcf85f6b296c0e71aebbb262bd8023e54e59ed8ad (diff)
downloadstrongswan-fdd94fc846ca2057ab2994e92e712da63f760580.tar.bz2
strongswan-fdd94fc846ca2057ab2994e92e712da63f760580.tar.xz
Add a delay option to load-tester socket
Diffstat (limited to 'src/libcharon/plugins/load_tester/load_tester_control.c')
-rw-r--r--src/libcharon/plugins/load_tester/load_tester_control.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libcharon/plugins/load_tester/load_tester_control.c b/src/libcharon/plugins/load_tester/load_tester_control.c
index db2a31368..0c21c23ca 100644
--- a/src/libcharon/plugins/load_tester/load_tester_control.c
+++ b/src/libcharon/plugins/load_tester/load_tester_control.c
@@ -223,7 +223,7 @@ static job_requeue_t initiate(FILE *stream)
enumerator_t *enumerator;
peer_cfg_t *peer_cfg;
child_cfg_t *child_cfg;
- u_int i, count, failed = 0;
+ u_int i, count, failed = 0, delay = 0;
char buf[16] = "";
fflush(stream);
@@ -231,7 +231,7 @@ static job_requeue_t initiate(FILE *stream)
{
return JOB_REQUEUE_NONE;
}
- if (sscanf(buf, "%u", &count) != 1)
+ if (sscanf(buf, "%u %u", &count, &delay) < 1)
{
return JOB_REQUEUE_NONE;
}
@@ -285,6 +285,10 @@ static job_requeue_t initiate(FILE *stream)
fprintf(stream, "!");
break;
}
+ if (delay)
+ {
+ usleep(delay * 1000);
+ }
fflush(stream);
}