]> jfr.im git - solanum.git/blobdiff - ircd/modules.c
ssld: avoid clang static analysis warning
[solanum.git] / ircd / modules.c
index 839eb0123a1f09e4efb105633803cc3f771d24c3..e1d9a564790c1e6aba98d2cfa00da1effee14d70 100644 (file)
@@ -428,7 +428,6 @@ load_a_module(const char *path, bool warn, int origin, bool core)
        lt_dlhandle tmpptr;
        char *mod_displayname, *c;
        const char *ver, *description = NULL;
-       size_t module_ext_len = strlen(LT_MODULE_EXT);
 
        int *mapi_version;
 
@@ -665,3 +664,38 @@ load_a_module(const char *path, bool warn, int origin, bool core)
        rb_free(mod_displayname);
        return true;
 }
+
+void
+modules_do_restart(void *unused)
+{
+       unsigned int modnum = 0;
+       rb_dlink_node *ptr, *nptr;
+
+       RB_DLINK_FOREACH_SAFE(ptr, nptr, module_list.head)
+       {
+               struct module *mod = ptr->data;
+               if(!unload_one_module(mod->name, false))
+               {
+                       ilog(L_MAIN, "Module Restart: %s was not unloaded %s",
+                            mod->name,
+                            mod->core? "(core module)" : "");
+
+                       if(!mod->core)
+                               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
+                                                      "Module Restart: %s failed to unload",
+                                                      mod->name);
+                       continue;
+               }
+
+               modnum++;
+       }
+
+       load_all_modules(false);
+       load_core_modules(false);
+       rehash(false);
+
+       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
+                            "Module Restart: %u modules unloaded, %lu modules loaded",
+                            modnum, rb_dlink_list_length(&module_list));
+       ilog(L_MAIN, "Module Restart: %u modules unloaded, %lu modules loaded", modnum, rb_dlink_list_length(&module_list));
+}