It should only be HUP'd every few seconds
pthread_mutex_t *mutex;
#endif
CONF_SECTION *cs;
+ time_t last_hup;
bool instantiated;
bool force;
rlm_rcode_t code;
int rcode;
cached_config_t *cc;
CONF_SECTION *cs;
+ time_t when;
char buffer[1024];
+ static time_t last_hup = 0;
+
/*
* Re-open the log file. If we can't, then keep logging
* to the old log file.
*/
hup_logfile();
+ /*
+ * Only check the config files every few seconds.
+ */
+ when = time(NULL);
+ if ((last_hup + 2) >= when) {
+ INFO("HUP - Last HUP was too recent. Ignoring");
+ return;
+ }
+ last_hup = when;
+
rcode = cf_file_changed(cs_cache->cs);
if (rcode == CF_FILE_NONE) {
INFO("HUP - No files changed. Ignoring");
#endif
node->instantiated = true;
+ node->last_hup = time(NULL); /* don't let us load it, then immediately hup it */
return node;
}
return 1;
}
+ /*
+ * Silently ignore multiple HUPs within a short time period.
+ */
+ if ((node->last_hup + 2) >= when) return 1;
+ node->last_hup = when;
+
cf_log_module(cs, "Trying to reload module \"%s\"", node->name);
/*