- * Create any DICT_VALUE's for the types. See
- * 'doc/configurable_failover' for examples of 'authtype'
- * used to create new Auth-Type values. In order to
- * let the user create new names, we've got to look for
- * those names, and create DICT_VALUE's for them.
+ * If we succeed the first time around, remember that.
+ */
+ first_time = FALSE;
+
+ return 0;
+}
+
+int module_hup_module(CONF_SECTION *cs, module_instance_t *node, time_t when)
+{
+ void *insthandle = NULL;
+ fr_module_hup_t *mh;
+
+ if (!node ||
+ !node->entry->module->instantiate ||
+ ((node->entry->module->type & RLM_TYPE_HUP_SAFE) == 0)) {
+ return 1;
+ }
+
+ cf_log_module(cs, "Trying to reload module \"%s\"", node->name);
+
+ if ((node->entry->module->instantiate)(cs, &insthandle) < 0) {
+ cf_log_err(cf_sectiontoitem(cs),
+ "HUP failed for module \"%s\". Using old configuration.",
+ node->name);
+ return 0;
+ }
+
+ radlog(L_INFO, " Module: Reloaded module \"%s\"", node->name);
+
+ module_instance_free_old(cs, node, when);
+
+ /*
+ * Save the old instance handle for later deletion.
+ */
+ mh = rad_malloc(sizeof(*mh));
+ mh->mi = node;
+ mh->when = when;
+ mh->insthandle = node->insthandle;
+ mh->next = node->mh;
+ node->mh = mh;
+
+ node->insthandle = insthandle;
+
+ /*
+ * FIXME: Set a timeout to come back in 60s, so that
+ * we can pro-actively clean up the old instances.
+ */
+
+ return 1;
+}
+
+
+int module_hup(CONF_SECTION *modules)
+{
+ time_t when;
+ CONF_ITEM *ci;
+ CONF_SECTION *cs;
+ module_instance_t *node;
+
+ if (!modules) return 0;
+
+ when = time(NULL);
+
+ /*
+ * Loop over the modules