]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add configurable poll_interval
authorAlan T. DeKok <aland@freeradius.org>
Thu, 19 Oct 2017 12:36:45 +0000 (08:36 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 19 Oct 2017 12:36:45 +0000 (08:36 -0400)
src/modules/proto_detail/proto_detail.h
src/modules/proto_detail/proto_detail_file.c

index 3e9f89d6e9b07e84346f608d8ecd1e9d805da6d8..8dfa12cae0ce6b78bac05b4f676751d6445f108b 100644 (file)
@@ -79,6 +79,8 @@ typedef struct proto_detail_work_t {
        char const                      *filename;              //!< file name, usually with wildcards
        char const                      *filename_work;         //!< work file name
 
+       uint32_t                        poll_interval;          //!< interval between polling
+
        bool                            vnode;                  //!< are we the vnode instance,
                                                                //!< or the filename_work instance?
        bool                            eof;                    //!< are we at EOF on reading?
index 093dfe1272c4d4e08173b0238ed2a6a4eec3a77b..0c5d47817983bfc02d1513ed91b3146760048e3e 100644 (file)
@@ -67,6 +67,8 @@ static const CONF_PARSER file_listen_config[] = {
 
        { FR_CONF_OFFSET("track", FR_TYPE_BOOL, proto_detail_file_t, track_progress ) },
 
+       { FR_CONF_OFFSET("poll_interval", FR_TYPE_UINT32, proto_detail_file_t, poll_interval ) },
+
        CONF_PARSER_TERMINATOR
 };
 
@@ -392,11 +394,9 @@ redo:
                }
 
                /*
-                *      Check every 5 seconds.
-                *
-                *      @todo - make this configurable.
+                *      Check every N seconds.
                 */
-               when.tv_sec = 5;
+               when.tv_sec = inst->poll_interval;
                when.tv_usec = 0;
 
                DEBUG3("Waiting %d.%06ds for new files in %s",
@@ -463,6 +463,9 @@ static int mod_bootstrap(void *instance, CONF_SECTION *cs)
        dl_inst = dl_instance_find(instance);
        rad_assert(dl_inst);
 
+       FR_INTEGER_BOUND_CHECK("poll_interval", inst->poll_interval, >=, 1);
+       FR_INTEGER_BOUND_CHECK("poll_interval", inst->poll_interval, <=, 3600);
+
        inst->parent = talloc_get_type_abort(dl_inst->parent->data, proto_detail_t);
        inst->cs = cs;
        inst->fd = -1;