mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 08:42:34 +01:00
construct: Leak a dynamic io_context instance; temp workaround to s_dns symbol issue.
This commit is contained in:
parent
c9ab8c345c
commit
864f50da17
1 changed files with 14 additions and 9 deletions
|
@ -81,8 +81,17 @@ const char *const usererrstr
|
||||||
%s
|
%s
|
||||||
)"};
|
)"};
|
||||||
|
|
||||||
int
|
// This is the sole io_context for Construct, and the ios.run() below is the
|
||||||
main(int _argc, char *const *_argv, char *const *const _envp)
|
// the only place where the program actually blocks.
|
||||||
|
// TODO: Global symbol linking issue triggered by loading module s_dns.so (which
|
||||||
|
///TODO: involves asio.h) causes dangling references in ~io_context(). This has
|
||||||
|
// TODO: to be dynamic and leak until fixed.
|
||||||
|
boost::asio::io_context *const ios
|
||||||
|
{
|
||||||
|
new boost::asio::io_context
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(int _argc, char *const *_argv, char *const *const _envp)
|
||||||
noexcept try
|
noexcept try
|
||||||
{
|
{
|
||||||
umask(077); // better safe than sorry --SRB
|
umask(077); // better safe than sorry --SRB
|
||||||
|
@ -151,14 +160,10 @@ noexcept try
|
||||||
}};
|
}};
|
||||||
}};
|
}};
|
||||||
|
|
||||||
// This is the sole io_context for Construct, and the ios.run() below is the
|
|
||||||
// the only place where the program actually blocks.
|
|
||||||
boost::asio::io_context ios;
|
|
||||||
|
|
||||||
// Associates libircd with our io_context and posts the initial routines
|
// Associates libircd with our io_context and posts the initial routines
|
||||||
// to that io_context. Execution of IRCd will then occur during ios::run()
|
// to that io_context. Execution of IRCd will then occur during ios::run()
|
||||||
// note: only supports service for one hostname/origin at this time.
|
// note: only supports service for one hostname/origin at this time.
|
||||||
ircd::init(ios, origin, hostname);
|
ircd::init(*ios, origin, hostname);
|
||||||
|
|
||||||
// libircd does no signal handling (or at least none that you ever have to
|
// libircd does no signal handling (or at least none that you ever have to
|
||||||
// care about); reaction to all signals happens out here instead. Handling
|
// care about); reaction to all signals happens out here instead. Handling
|
||||||
|
@ -167,7 +172,7 @@ noexcept try
|
||||||
// event loop. This means we lose the true instant hardware-interrupt gratitude
|
// event loop. This means we lose the true instant hardware-interrupt gratitude
|
||||||
// of signals but with the benefit of unconditional safety and cross-
|
// of signals but with the benefit of unconditional safety and cross-
|
||||||
// platformness with windows etc.
|
// platformness with windows etc.
|
||||||
const construct::signals signals{ios};
|
const construct::signals signals{*ios};
|
||||||
|
|
||||||
// If the user wants to immediately drop to an interactive command line
|
// If the user wants to immediately drop to an interactive command line
|
||||||
// without having to send a ctrl-c for it, that is provided here. This does
|
// without having to send a ctrl-c for it, that is provided here. This does
|
||||||
|
@ -187,7 +192,7 @@ noexcept try
|
||||||
|
|
||||||
// Execution.
|
// Execution.
|
||||||
// Blocks until a clean exit from a quit() or an exception comes out of it.
|
// Blocks until a clean exit from a quit() or an exception comes out of it.
|
||||||
ios.run();
|
ios->run();
|
||||||
|
|
||||||
// The smoketest is enabled if the first value is true; then all of the
|
// The smoketest is enabled if the first value is true; then all of the
|
||||||
// values must be true for the smoketest to pass.
|
// values must be true for the smoketest to pass.
|
||||||
|
|
Loading…
Reference in a new issue