0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-20 10:58:20 +02:00

construct/ircd: Add option to soft-indicate no listening sockets should be bound.

This commit is contained in:
Jason Volk 2018-03-16 18:59:28 -07:00
parent 486ddf8c8f
commit 7daef82218
4 changed files with 14 additions and 1 deletions

View file

@ -52,6 +52,7 @@ lgetopt opts[] =
{ "debug", &ircd::debugmode, lgetopt::BOOL, "Enable options for debugging" },
{ "console", &cmdline, lgetopt::BOOL, "Drop to a command line immediately after startup" },
{ "execute", &execute, lgetopt::STRING, "Execute command lines immediately after startup" },
{ "nolisten", &ircd::nolisten, lgetopt::BOOL, "Normal execution but without listening sockets" },
{ nullptr, nullptr, lgetopt::STRING, nullptr },
};

View file

@ -184,7 +184,8 @@ namespace ircd
constexpr size_t BUFSIZE { 512 };
extern const enum runlevel &runlevel;
extern const std::string &config;
extern bool debugmode; ///< Toggle; available only ifdef RB_DEBUG
extern bool debugmode; ///< Toggle; available only ifdef RB_DEBUG
extern bool nolisten; ///< Init option to not bind listener socks.
std::string demangle(const std::string &symbol);
template<class T> std::string demangle();

View file

@ -22,6 +22,7 @@ namespace ircd
ctx::ctx *main_context; // Main program loop
bool debugmode; // meaningful ifdef RB_DEBUG
bool nolisten; // indicates no listener binding
void set_runlevel(const enum runlevel &);
void at_main_exit() noexcept;

View file

@ -158,6 +158,16 @@ namespace ircd::m
void
ircd::m::init::listeners()
{
if(ircd::nolisten)
{
log::warning
{
"Not listening on any addresses because nolisten flag is set."
};
return;
}
const json::array listeners
{
config["listeners"]