From: Alan T. DeKok Date: Wed, 29 Apr 2020 19:58:32 +0000 (-0400) Subject: add and document "repeat" functionality X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63867ccce6e0b4061d2c8a70ad90124bbadff396;p=thirdparty%2Ffreeradius-server.git add and document "repeat" functionality --- diff --git a/raddb/sites-available/test_load b/raddb/sites-available/test_load index 0ed5406ee7c..d578994792a 100644 --- a/raddb/sites-available/test_load +++ b/raddb/sites-available/test_load @@ -123,6 +123,13 @@ server load { # back to sending at the "pps" rate. # max_backlog = 1000 + + + # + # repeat:: whether or not to start again after + # we reach max_pps + # + repeat = no } } diff --git a/src/modules/proto_radius/proto_radius_load.c b/src/modules/proto_radius/proto_radius_load.c index 4d7828c60ff..49b366684af 100644 --- a/src/modules/proto_radius/proto_radius_load.c +++ b/src/modules/proto_radius/proto_radius_load.c @@ -90,7 +90,7 @@ struct proto_radius_load_s { RADCLIENT *client; //!< static client fr_load_config_t load; //!< load configuration - + bool repeat; //!, do we repeat the load generation char const *csv; //!< where to write CSV stats }; @@ -108,6 +108,7 @@ static const CONF_PARSER load_listen_config[] = { { FR_CONF_OFFSET("step", FR_TYPE_UINT32, proto_radius_load_t, load.step) }, { FR_CONF_OFFSET("max_backlog", FR_TYPE_UINT32, proto_radius_load_t, load.milliseconds) }, { FR_CONF_OFFSET("parallel", FR_TYPE_UINT32, proto_radius_load_t, load.parallel) }, + { FR_CONF_OFFSET("repeat", FR_TYPE_BOOL, proto_radius_load_t, repeat) }, CONF_PARSER_TERMINATOR }; @@ -188,7 +189,12 @@ static ssize_t mod_write(fr_listen_t *li, UNUSED void *packet_ctx, fr_time_t req */ state = fr_load_generator_have_reply(thread->l, request_time); if (state == FR_LOAD_DONE) { - thread->done = true; + if (!thread->inst->repeat) { + thread->done = true; + } else { + (void) fr_load_generator_stop(thread->l); /* ensure l->ev is gone */ + (void) fr_load_generator_start(thread->l); + } } return buffer_len;