Add a delay option to load-tester socket

This commit is contained in:
Martin Willi
2012-11-29 10:22:51 +01:00
parent cf85f6b296
commit fdd94fc846
2 changed files with 11 additions and 7 deletions
@@ -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);
}