0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 08:12:37 +01:00

ircd::run: Add additional UNLOAD runlevel on shutdown after QUIT.

This commit is contained in:
Jason Volk 2020-06-12 18:37:16 -07:00
parent 8003c07762
commit cfba2b52c9
4 changed files with 14 additions and 9 deletions

View file

@ -39,7 +39,7 @@ bool norun;
bool read_only;
bool write_avoid;
bool slave;
std::array<bool, 7> smoketest;
std::array<bool, 8> smoketest;
bool soft_assert;
bool nomatrix;
bool matrix {true}; // matrix server by default.
@ -285,7 +285,7 @@ noexcept try
return;
}
if(level != ircd::run::level::QUIT || !context)
if(level != ircd::run::level::UNLOAD || !context)
return;
// 10 Notify the waiting homeserver context to quit; this will

View file

@ -71,7 +71,8 @@ enum class ircd::run::level
START = 2, ///< | | Starting internal subsystems.
LOAD = 3, ///< | | Load user application.
RUN = 4, ///< O | IRCd in service.
QUIT = 5, ///< --> ^ Clean shutdown in progress.
QUIT = 5, ///< | | Clean shutdown starting.
UNLOAD = 6, ///< --> ^ Unload user application.
};
/// An instance of this class registers itself to be called back when

View file

@ -215,8 +215,9 @@ noexcept
return true;
}
case run::level::HALT:
case run::level::UNLOAD:
case run::level::QUIT:
case run::level::HALT:
case run::level::FAULT:
return false;
}
@ -308,10 +309,11 @@ noexcept try
server::init _server_; // Server related
js::init _js_; // SpiderMonkey
// Transition to the QUIT state on unwind.
// Transition to the QUIT and UNLOAD states on unwind.
const unwind quit{[]
{
ircd::run::set(run::level::QUIT);
ircd::run::set(run::level::UNLOAD);
}};
ctx::interruption_point();

View file

@ -139,10 +139,11 @@ try
{
switch(level)
{
case level::HALT: break;
case level::QUIT: break;
case level::LOAD: throw;
default: throw;
case level::HALT: break;
case level::QUIT: break;
case level::UNLOAD: break;
case level::LOAD: throw;
default: throw;
}
log::error
@ -199,6 +200,7 @@ ircd::run::reflect(const enum run::level &level)
case level::LOAD: return "LOAD";
case level::RUN: return "RUN";
case level::QUIT: return "QUIT";
case level::UNLOAD: return "UNLOAD";
case level::FAULT: return "FAULT";
}