mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-02 08:16:36 +02:00
Fix warning regarding low ms_every in case of delayed module unloading.
This commit is contained in:
+4
-1
@@ -47,13 +47,15 @@ extern EVENT(unrealdns_removeoldrecords);
|
||||
Event *EventAdd(Module *module, char *name, vFP event, void *data, long every_msec, int count)
|
||||
{
|
||||
Event *newevent;
|
||||
|
||||
if (!name || (every_msec < 0) || (count < 0) || !event)
|
||||
{
|
||||
if (module)
|
||||
module->errorcode = MODERR_INVALID;
|
||||
return NULL;
|
||||
}
|
||||
if (every_msec < 100)
|
||||
|
||||
if ((every_msec < 100) && (count > 1))
|
||||
{
|
||||
ircd_log(LOG_ERROR, "[BUG] EventAdd() from module %s with suspiciously low every_msec value (%ld). "
|
||||
"Note that it is in milliseconds now (1000 = 1 second)!",
|
||||
@@ -61,6 +63,7 @@ Event *EventAdd(Module *module, char *name, vFP event, void *data, long every_ms
|
||||
every_msec);
|
||||
every_msec = 100;
|
||||
}
|
||||
|
||||
newevent = safe_alloc(sizeof(Event));
|
||||
safe_strdup(newevent->name, name);
|
||||
newevent->count = count;
|
||||
|
||||
+1
-1
@@ -1445,7 +1445,7 @@ void special_delayed_unloading(void)
|
||||
if (!found)
|
||||
{
|
||||
char *name = strdup(m->header->name);
|
||||
config_warn("Delaying module unloading of '%s' a few seconds...", name);
|
||||
config_warn("Delaying module unloading of '%s' for a millisecond...", name);
|
||||
m->flags |= MODFLAG_DELAYED;
|
||||
EventAdd(NULL, "e_unload_module_delayed", e_unload_module_delayed, name, 0, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user