# causing databases to go into overload.
#
load_factor = 10
+
+ #
+ # Set the interval for polling the detail file.
+ # If the detail file doesn't exist, the server will
+ # wake up, and poll for it every N seconds.
+ #
+ # Useful range of values: 1 to 60
+ poll_interval = 1
}
#
int detail_decode(UNUSED rad_listen_t *this, UNUSED REQUEST *request);
int detail_parse(CONF_SECTION *cs, rad_listen_t *this);
int detail_delay(rad_listen_t *this);
+int detail_poll_interval(rad_listen_t *listener);
#endif /* DETAIL_H */
fr_ipaddr_t client_ip;
int load_factor; /* 1..100 */
int signal;
+ int poll_interval;
int has_rtt;
int srtt;
offsetof(listen_detail_t, filename), NULL, NULL },
{ "load_factor", PW_TYPE_INTEGER,
offsetof(listen_detail_t, load_factor), NULL, Stringify(10)},
+ { "poll_interval", PW_TYPE_INTEGER,
+ offsetof(listen_detail_t, poll_interval), NULL, Stringify(1)},
{ NULL, -1, 0, NULL, NULL } /* end the list */
};
return -1;
}
+ if ((data->poll_interval < 1) || (data->poll_interval > 3600)) {
+ cf_log_err(cf_sectiontoitem(cs), "poll_interval must be between 1 and 3600");
+ return -1;
+ }
+
/*
* If the filename is a glob, use "detail.work" as the
* work file name.
return 0;
}
+
+int detail_poll_interval(rad_listen_t *listener)
+{
+ listen_detail_t *data = listener->data;
+
+ return data->poll_interval;
+}
+
#endif
fr_event_now(el, &now);
when = now;
+ rad_assert(this->type == RAD_LISTEN_DETAIL);
+
/*
- * Set the next poll time to be 10.0s to 10.5s, to help
+ * Set the next poll time to be X +/- 0.5s, to help
* spread the load a bit over time.
*/
- when.tv_sec += 10;
+ when.tv_sec += detail_poll_interval(this);
when.tv_usec += fr_rand() % (USEC / 2);
- rad_assert(this->type == RAD_LISTEN_DETAIL);
-
/*
* Try to read something.
*