0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 03:38:53 +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" }, { "debug", &ircd::debugmode, lgetopt::BOOL, "Enable options for debugging" },
{ "console", &cmdline, lgetopt::BOOL, "Drop to a command line immediately after startup" }, { "console", &cmdline, lgetopt::BOOL, "Drop to a command line immediately after startup" },
{ "execute", &execute, lgetopt::STRING, "Execute command lines 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 }, { nullptr, nullptr, lgetopt::STRING, nullptr },
}; };

View file

@ -185,6 +185,7 @@ namespace ircd
extern const enum runlevel &runlevel; extern const enum runlevel &runlevel;
extern const std::string &config; 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); std::string demangle(const std::string &symbol);
template<class T> std::string demangle(); template<class T> std::string demangle();

View file

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

View file

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