mirror of
https://github.com/anope/anope.git
synced 2026-07-06 09:53:13 +02:00
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
git-svn-id: svn://svn.anope.org/anope/trunk@1124 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@848 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
parent
a1edb7a0c2
commit
11b73a098c
+9
-5
@@ -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)
|
||||
snprintf(buf, sizeof(buf), "Sending event %s %s",
|
||||
EVENT_DB_EXPIRE, EVENT_START);
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case -31:
|
||||
|
||||
@@ -462,7 +466,7 @@ void sighandler(int signum)
|
||||
signum == SIGUSR1 ||
|
||||
#endif
|
||||
!(quitmsg = calloc(BUFSIZE, 1))) {
|
||||
quitmsg = "Out of memory!";
|
||||
quitmsg = "Out of memory!";
|
||||
} else {
|
||||
#if HAVE_STRSIGNAL
|
||||
snprintf(quitmsg, BUFSIZE, "Services terminating: %s",
|
||||
|
||||
+23
-21
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user