User connections enable/disable config flag (#209)

This commit is contained in:
Chalith Desaman
2021-01-06 09:36:48 +05:30
committed by GitHub
parent e8a3882176
commit a16eb39d1f
3 changed files with 18 additions and 4 deletions

View File

@@ -42,9 +42,16 @@ namespace usr
if (input_store.init() == -1)
return -1;
// Start listening for incoming user connections.
if (start_listening() == -1)
return -1;
// Start listening for incoming user connections only if user connections config is enabled.
if (conf::cfg.user.enabled)
{
if (start_listening() == -1)
return -1;
}
else
{
LOG_INFO << "User connection listner isn't started since user connections are disabled.";
}
init_success = true;
return 0;
@@ -57,7 +64,11 @@ namespace usr
{
if (init_success)
{
ctx.server->stop();
// Stop com server only if user connections config is enabled (Otherwise server hasn't been started).
if (conf::cfg.user.enabled)
{
ctx.server->stop();
}
input_store.deinit();
}
}