mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
fixup! ircd: Minor cleanup.
This commit is contained in:
parent
e7844a0771
commit
8fdc6a4794
1 changed files with 13 additions and 15 deletions
28
ircd/ircd.cc
28
ircd/ircd.cc
|
@ -54,17 +54,15 @@ ircd::init(boost::asio::io_service &io_service,
|
||||||
|
|
||||||
// The log is available, but it is console-only until conf opens files.
|
// The log is available, but it is console-only until conf opens files.
|
||||||
log::init();
|
log::init();
|
||||||
log::mark("log started");
|
log::mark("START");
|
||||||
|
|
||||||
// The configuration is parsed for grammatical errors only. It is not evaluated.
|
if(main_exit_func)
|
||||||
log::info("parsing your configuration");
|
{
|
||||||
|
log::debug("User set an exit callback");
|
||||||
// The caller has no other way to know IRCd has halted as everyone shares the
|
at_main_exit(std::move(main_exit_func));
|
||||||
// same io_service, which may not return if the caller has their own tasks.
|
}
|
||||||
at_main_exit(std::move(main_exit_func));
|
|
||||||
|
|
||||||
// The master of ceremonies runs the show after this function returns and ios.run().
|
// The master of ceremonies runs the show after this function returns and ios.run().
|
||||||
log::debug("spawning main context");
|
|
||||||
context mc("main", 8_MiB, ircd::main); //TODO: optimize stack size
|
context mc("main", 8_MiB, ircd::main); //TODO: optimize stack size
|
||||||
main_context = mc.detach();
|
main_context = mc.detach();
|
||||||
|
|
||||||
|
@ -95,15 +93,10 @@ try
|
||||||
// to the main context. Initialization can also occur in ircd::init() if static initialization
|
// to the main context. Initialization can also occur in ircd::init() if static initialization
|
||||||
// and destruction is not possible, but there is no complementary destruction up there.
|
// and destruction is not possible, but there is no complementary destruction up there.
|
||||||
ctx::ole::init _ole_;
|
ctx::ole::init _ole_;
|
||||||
mods::init _mods_;
|
|
||||||
db::init _db_;
|
|
||||||
//js::init _js_;
|
//js::init _js_;
|
||||||
socket::init _sock_;
|
socket::init _sock_;
|
||||||
client::init _client_;
|
client::init _client_;
|
||||||
|
|
||||||
//json::test();
|
|
||||||
//exit(0);
|
|
||||||
|
|
||||||
module client_versions("client_versions.so");
|
module client_versions("client_versions.so");
|
||||||
module client_register("client_register.so");
|
module client_register("client_register.so");
|
||||||
module client_login("client_login.so");
|
module client_login("client_login.so");
|
||||||
|
@ -153,10 +146,15 @@ try
|
||||||
ctx::wait();
|
ctx::wait();
|
||||||
}
|
}
|
||||||
while(!main_finish);
|
while(!main_finish);
|
||||||
|
|
||||||
|
log::notice("IRCd terminating");
|
||||||
}
|
}
|
||||||
catch(const std::exception &e)
|
catch(const std::exception &e)
|
||||||
{
|
{
|
||||||
log::error("IRCd finished: %s", e.what());
|
log::critical("IRCd terminated: %s", e.what());
|
||||||
|
|
||||||
|
if(ircd::debugmode)
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -171,7 +169,7 @@ noexcept try
|
||||||
// This function will notify the user of IRCd shutdown. The notification is
|
// This function will notify the user of IRCd shutdown. The notification is
|
||||||
// posted to the io_service ensuring THERE IS NO CONTINUATION ON THIS STACK by
|
// posted to the io_service ensuring THERE IS NO CONTINUATION ON THIS STACK by
|
||||||
// the user, who is then free to destruct all elements of IRCd.
|
// the user, who is then free to destruct all elements of IRCd.
|
||||||
log::debug("Notifying user of IRCd completion");
|
log::notice("Notifying user of IRCd completion");
|
||||||
ios->post(main_exit_func);
|
ios->post(main_exit_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue