diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-11-26 15:14:07 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-11-26 15:14:07 +0100 |
commit | 19cc9292ab5889fa09962820f3179e8078bec956 (patch) | |
tree | b2a000f3ba48cc85ce4717aa206492e6dd1a4a03 /src | |
parent | d3eb1a77d7ee2f924ab0fd6e5642fb328e4209d8 (diff) |
core_reloadmodule Allow modules to handle reload failures of other mods
Diffstat (limited to 'src')
-rw-r--r-- | src/coremods/core_reloadmodule.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/coremods/core_reloadmodule.cpp b/src/coremods/core_reloadmodule.cpp index 755b49abf..0d01d9e85 100644 --- a/src/coremods/core_reloadmodule.cpp +++ b/src/coremods/core_reloadmodule.cpp @@ -236,6 +236,10 @@ class DataKeeper * @param newmod Newly loaded instance of the module which had its data saved */ void Restore(Module* newmod); + + /** Handle reload failure + */ + void Fail(); }; void DataKeeper::DoSaveUsers() @@ -468,6 +472,14 @@ void DataKeeper::Restore(Module* newmod) ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Restore finished"); } +void DataKeeper::Fail() +{ + this->mod = NULL; + + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Restore failed, notifying modules"); + DoRestoreModules(); +} + void DataKeeper::RestoreObj(const OwnedModesExts& data, Extensible* extensible, ModeType modetype, Modes::ChangeList& modechange) { RestoreExtensions(data.extlist, extensible); @@ -583,6 +595,8 @@ class ReloadAction : public HandlerBase0<void> Module* newmod = ServerInstance->Modules->Find(name); datakeeper.Restore(newmod); } + else + datakeeper.Fail(); ServerInstance->SNO->WriteGlobalSno('a', "RELOAD MODULE: %s %ssuccessfully reloaded", passedname.c_str(), result ? "" : "un"); User* user = ServerInstance->FindUUID(uuid); |