summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes3
-rw-r--r--include/extern.h2
-rw-r--r--src/main.c14
-rw-r--r--src/modules.c44
-rw-r--r--version.log6
5 files changed, 40 insertions, 29 deletions
diff --git a/Changes b/Changes
index da3a4c84f..f29ebb033 100644
--- a/Changes
+++ b/Changes
@@ -7,9 +7,10 @@ Provided by Anope Dev. <dev@anope.org> - 2006
06/22 A Support startup flag. [ #00]
06/21 A Module version check. [ #00]
06/25 A Optional strict privmsg format. [ #00]
-07/22 R Removed clone stuff. [ #00]
07/15 A Added BOT_LONG_IDENT for too long idents. [#538]
07/10 A Moved ns_noop into core and assigned an NI_ flag. [#423]
+08/06 A Option to modules_unload_all() to say if we should unload proto. [#552]
+07/22 R Removed clone stuff. [ #00]
04/08 F Fixed Charybdis support on win32. [#487]
04/08 F Fixed thread stuff on windows. [#488]
04/08 F Fixed SGLine stuff on inspircd (not supported). [#489]
diff --git a/include/extern.h b/include/extern.h
index d324fb177..b49cbe0bf 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -844,7 +844,7 @@ E char **buildStringList(char *src, int *number);
/**** modules.c ****/
E void modules_core_init(int number, char **list);
-E void modules_unload_all(boolean fini); /* Read warnings near function source */
+E void modules_unload_all(boolean fini, boolean unload_proto); /* Read warnings near function source */
E void moduleCallBackRun(void);
E void moduleCleanStruct(ModuleData **moduleData);
diff --git a/src/main.c b/src/main.c
index dca9011d9..2c05f8a86 100644
--- a/src/main.c
+++ b/src/main.c
@@ -225,7 +225,9 @@ static void services_restart(void)
anope_cmd_squit(ServerName, quitmsg);
disconn(servsock);
close_log();
- modules_unload_all(true);
+ /* First don't unload protocol module, then do so */
+ modules_unload_all(true, false);
+ modules_unload_all(true, true);
execve(SERVICES_BIN, my_av, my_envp);
if (!readonly) {
open_log();
@@ -278,7 +280,9 @@ static void services_shutdown(void)
}
send_event(EVENT_SHUTDOWN, 1, EVENT_STOP);
disconn(servsock);
- modules_unload_all(true); /* Only legitimate use of this function */
+ /* First don't unload protocol module, then do so */
+ modules_unload_all(true, false);
+ modules_unload_all(true, true);
}
/*************************************************************************/
@@ -363,7 +367,7 @@ void sighandler(int signum)
inbuf[448] = 0;
}
wallops(NULL, "PANIC! buffer = %s\r\n", inbuf);
- modules_unload_all(false);
+ modules_unload_all(false, true);
} else if (waiting < 0) {
/* This is static on the off-chance we run low on stack */
static char buf[BUFSIZE];
@@ -440,7 +444,7 @@ void sighandler(int signum)
}
wallops(NULL, "PANIC! %s (%s)", buf, strsignal(signum));
alog("PANIC! %s (%s)", buf, strsignal(signum));
- modules_unload_all(false);
+ modules_unload_all(false, true);
}
}
@@ -462,7 +466,7 @@ void sighandler(int signum)
if (signum == SIGSEGV) {
do_backtrace(1);
- modules_unload_all(false); /* probably cant do this, but might as well try, we have nothing left to loose */
+ modules_unload_all(false, true); /* probably cant do this, but might as well try, we have nothing left to loose */
}
/* Should we send the signum here as well? -GD */
send_event(EVENT_SIGNAL, 1, quitmsg);
diff --git a/src/modules.c b/src/modules.c
index bbe44b18b..e1c2225da 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -234,7 +234,7 @@ void modules_delayed_init(void)
* And if that isn't enough discouragement, you'll wake up with your
* both legs broken tomorrow ;) -GD
*/
-void modules_unload_all(boolean fini)
+void modules_unload_all(boolean fini, boolean unload_proto)
{
#ifdef USE_MODULES
int idx;
@@ -245,26 +245,28 @@ void modules_unload_all(boolean fini)
mh = MODULE_HASH[idx];
while (mh) {
next = mh->next;
- mod_current_module = mh->m;
- if(fini) {
- func = (void (*)(void))ano_modsym(mh->m->handle, "AnopeFini");
- if (func) {
- mod_current_module_name = mh->m->name;
- func(); /* exec AnopeFini */
- mod_current_module_name = NULL;
- }
-
- if (prepForUnload(mh->m) != MOD_ERR_OK) {
- mh = next;
- continue;
- }
-
- if ((ano_modclose(mh->m->handle)) != 0)
- alog(ano_moderr());
- else
- delModule(mh->m);
- } else {
- delModule(mh->m);
+ if (unload_proto || (mh->m->type != PROTOCOL)) {
+ mod_current_module = mh->m;
+ if(fini) {
+ func = (void (*)(void))ano_modsym(mh->m->handle, "AnopeFini");
+ if (func) {
+ mod_current_module_name = mh->m->name;
+ func(); /* exec AnopeFini */
+ mod_current_module_name = NULL;
+ }
+
+ if (prepForUnload(mh->m) != MOD_ERR_OK) {
+ mh = next;
+ continue;
+ }
+
+ if ((ano_modclose(mh->m->handle)) != 0)
+ alog(ano_moderr());
+ else
+ delModule(mh->m);
+ } else {
+ delModule(mh->m);
+ }
}
mh = next;
}
diff --git a/version.log b/version.log
index 664b7cdbf..5c8792b73 100644
--- a/version.log
+++ b/version.log
@@ -9,10 +9,14 @@ VERSION_MAJOR="1"
VERSION_MINOR="7"
VERSION_PATCH="14"
VERSION_EXTRA=""
-VERSION_BUILD="1123"
+VERSION_BUILD="1124"
# $Log$
#
+# BUILD : 1.7.14 (1124)
+# BUGS : 552
+# NOTES : Added a way to modules_unload_all() to specify if we should unload the protocol module or not
+#
# BUILD : 1.7.14 (1123)
# BUGS : 563
# NOTES : Fixed UseTSMode thing for ratbox; TS6 for ratbox should work now