aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-27 17:15:16 +0200
committerStefan Boberg <[email protected]>2021-09-27 17:15:16 +0200
commit7c1e92adea5eb9e492ec186d9913918eaf2c22e4 (patch)
tree1473ce9d0a812f1f3aca76a1e157b508e152ce1f
parenthttpsys: Added HTTP_SEND_RESPONSE_FLAG_BUFFER_DATA to response calls which sh... (diff)
downloadzen-7c1e92adea5eb9e492ec186d9913918eaf2c22e4.tar.xz
zen-7c1e92adea5eb9e492ec186d9913918eaf2c22e4.zip
mesh: Hide mesh functionality behind ZEN_ENABLE_MESH define
This enables us to hide it from users until it's actually useful
-rw-r--r--zenserver/config.cpp4
-rw-r--r--zenserver/config.h9
-rw-r--r--zenserver/zenserver.cpp4
3 files changed, 13 insertions, 4 deletions
diff --git a/zenserver/config.cpp b/zenserver/config.cpp
index 91fb80747..42f59b26c 100644
--- a/zenserver/config.cpp
+++ b/zenserver/config.cpp
@@ -122,12 +122,14 @@ ParseGlobalCliOptions(int argc, char* argv[], ZenServerOptions& GlobalOptions, Z
cxxopts::value<int>(GlobalOptions.BasePort)->default_value("1337"),
"<port number>");
+#if ZEN_ENABLE_MESH
options.add_option("network",
"m",
"mesh",
"Enable mesh network",
cxxopts::value<bool>(ServiceConfig.MeshEnabled)->default_value("false"),
"");
+#endif
options.add_option("diagnostics",
"",
@@ -311,7 +313,9 @@ ParseServiceConfig(const std::filesystem::path& DataRoot, ZenServiceConfig& Serv
throw std::runtime_error("failed to run global config script ('{}'): {}"_format(ConfigScript, e.what()).c_str());
}
+#if ZEN_ENABLE_MESH
ServiceConfig.MeshEnabled = lua["mesh"]["enable"].get_or(ServiceConfig.MeshEnabled);
+#endif
auto UpdateStringValueFromConfig = [](const sol::table& Table, std::string_view Key, std::string& OutValue) {
// Update the specified config value unless it has been set, i.e. from command line
diff --git a/zenserver/config.h b/zenserver/config.h
index ce059bdb2..75c19d690 100644
--- a/zenserver/config.h
+++ b/zenserver/config.h
@@ -56,10 +56,11 @@ struct ZenUpstreamCacheConfig
struct ZenServiceConfig
{
- bool StructuredCacheEnabled = true;
- bool ShouldCrash = false; // Option for testing crash handling
- bool MeshEnabled = false; // Experimental p2p mesh discovery
- std::string FlockId; // Id for grouping test instances into sets
+ bool StructuredCacheEnabled = true;
+ bool ShouldCrash = false; // Option for testing crash handling
+#if ZEN_ENABLE_MESH
+ bool MeshEnabled = false; // Experimental p2p mesh discovery
+#endif
ZenUpstreamCacheConfig UpstreamCacheConfig;
};
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index fe4f41ab5..b45df9fef 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -261,6 +261,7 @@ public:
ZEN_INFO("NOT instantiating structured cache service");
}
+#if ZEN_ENABLE_MESH
if (ServiceConfig.MeshEnabled)
{
StartMesh(BasePort);
@@ -269,6 +270,7 @@ public:
{
ZEN_INFO("NOT starting mesh");
}
+#endif
m_Http = zen::CreateHttpServer();
m_Http->Initialize(BasePort);
@@ -302,11 +304,13 @@ public:
}
}
+#if ZEN_ENABLE_MESH
void StartMesh(int BasePort)
{
ZEN_INFO("initializing mesh discovery");
m_ZenMesh.Start(uint16_t(BasePort));
}
+#endif
void Run()
{