aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-11-01 14:04:35 +0100
committerGitHub Enterprise <[email protected]>2025-11-01 14:04:35 +0100
commita58da97f98697580bf128ed5723ba720cc30f0dc (patch)
tree798e392ddf76128a506293dc0803aaf852203dcd /src/zenserver
parentfix use-after-free in TEST_CASE("compactcas.threadedinsert") (#620) (diff)
downloadzen-a58da97f98697580bf128ed5723ba720cc30f0dc.tar.xz
zen-a58da97f98697580bf128ed5723ba720cc30f0dc.zip
Various fixes to address issues flagged by gcc / non-UE toolchain build (#621)
* gcc: avoid using memset on nontrivial struct * redundant `return std::move` * fixed various compilation issues flagged by gcc * fix issue in xmake.lua detecting whether we are building with the UE toolchain or not * add GCC ignore -Wundef (comment is inaccurate) * remove redundant std::move * don't catch exceptions by value * unreferenced variables * initialize "by the book" instead of memset * remove unused exception reference * add #include <cstring> to fix gcc build * explicitly poulate KeyValueMap by traversing input spans fixes gcc compilation * remove unreferenced variable * eliminate redundant `std::move` which gcc complains about * fix gcc compilation by including <cstring> * tag unreferenced variable to fix gcc compilation * fixes for various cases of naming members the same as their type
Diffstat (limited to 'src/zenserver')
-rw-r--r--src/zenserver/config/config.cpp40
-rw-r--r--src/zenserver/config/config.h4
-rw-r--r--src/zenserver/config/luaconfig.cpp1
-rw-r--r--src/zenserver/main.cpp4
-rw-r--r--src/zenserver/storage/admin/admin.cpp10
-rw-r--r--src/zenserver/storage/buildstore/httpbuildstore.cpp2
-rw-r--r--src/zenserver/storage/storageconfig.cpp4
-rw-r--r--src/zenserver/zenserver.cpp4
8 files changed, 35 insertions, 34 deletions
diff --git a/src/zenserver/config/config.cpp b/src/zenserver/config/config.cpp
index e7cfd490a..18187711b 100644
--- a/src/zenserver/config/config.cpp
+++ b/src/zenserver/config/config.cpp
@@ -138,28 +138,28 @@ ZenServerConfiguratorBase::AddCommonConfigOptions(LuaConfig::Options& LuaOptions
LuaOptions.AddOption("server.noconsole"sv, ServerOptions.NoConsoleOutput, "noconsole"sv);
////// network
- LuaOptions.AddOption("network.httpserverclass"sv, ServerOptions.HttpServerConfig.ServerClass, "http"sv);
- LuaOptions.AddOption("network.httpserverthreads"sv, ServerOptions.HttpServerConfig.ThreadCount, "http-threads"sv);
+ LuaOptions.AddOption("network.httpserverclass"sv, ServerOptions.HttpConfig.ServerClass, "http"sv);
+ LuaOptions.AddOption("network.httpserverthreads"sv, ServerOptions.HttpConfig.ThreadCount, "http-threads"sv);
LuaOptions.AddOption("network.port"sv, ServerOptions.BasePort, "port"sv);
- LuaOptions.AddOption("network.forceloopback"sv, ServerOptions.HttpServerConfig.ForceLoopback, "http-forceloopback"sv);
+ LuaOptions.AddOption("network.forceloopback"sv, ServerOptions.HttpConfig.ForceLoopback, "http-forceloopback"sv);
#if ZEN_WITH_HTTPSYS
LuaOptions.AddOption("network.httpsys.async.workthreads"sv,
- ServerOptions.HttpServerConfig.HttpSys.AsyncWorkThreadCount,
+ ServerOptions.HttpConfig.HttpSys.AsyncWorkThreadCount,
"httpsys-async-work-threads"sv);
LuaOptions.AddOption("network.httpsys.async.response"sv,
- ServerOptions.HttpServerConfig.HttpSys.IsAsyncResponseEnabled,
+ ServerOptions.HttpConfig.HttpSys.IsAsyncResponseEnabled,
"httpsys-enable-async-response"sv);
LuaOptions.AddOption("network.httpsys.requestlogging"sv,
- ServerOptions.HttpServerConfig.HttpSys.IsRequestLoggingEnabled,
+ ServerOptions.HttpConfig.HttpSys.IsRequestLoggingEnabled,
"httpsys-enable-request-logging"sv);
#endif
#if ZEN_WITH_TRACE
////// trace
- LuaOptions.AddOption("trace.channels"sv, ServerOptions.TraceOptions.Channels, "trace"sv);
- LuaOptions.AddOption("trace.host"sv, ServerOptions.TraceOptions.Host, "tracehost"sv);
- LuaOptions.AddOption("trace.file"sv, ServerOptions.TraceOptions.File, "tracefile"sv);
+ LuaOptions.AddOption("trace.channels"sv, ServerOptions.TraceCmdLineOptions.Channels, "trace"sv);
+ LuaOptions.AddOption("trace.host"sv, ServerOptions.TraceCmdLineOptions.Host, "tracehost"sv);
+ LuaOptions.AddOption("trace.file"sv, ServerOptions.TraceCmdLineOptions.File, "tracefile"sv);
#endif
////// stats
@@ -291,7 +291,7 @@ ZenServerCmdLineOptions::AddCliOptions(cxxopts::Options& options, ZenServerConfi
"",
"http-threads",
"Number of http server connection threads",
- cxxopts::value<unsigned int>(ServerOptions.HttpServerConfig.ThreadCount),
+ cxxopts::value<unsigned int>(ServerOptions.HttpConfig.ThreadCount),
"<http threads>");
options.add_option("network",
@@ -305,7 +305,7 @@ ZenServerCmdLineOptions::AddCliOptions(cxxopts::Options& options, ZenServerConfi
"",
"http-forceloopback",
"Force using local loopback interface",
- cxxopts::value<bool>(ServerOptions.HttpServerConfig.ForceLoopback)->default_value("false"),
+ cxxopts::value<bool>(ServerOptions.HttpConfig.ForceLoopback)->default_value("false"),
"<http forceloopback>");
#if ZEN_WITH_HTTPSYS
@@ -313,21 +313,21 @@ ZenServerCmdLineOptions::AddCliOptions(cxxopts::Options& options, ZenServerConfi
"",
"httpsys-async-work-threads",
"Number of HttpSys async worker threads",
- cxxopts::value<unsigned int>(ServerOptions.HttpServerConfig.HttpSys.AsyncWorkThreadCount),
+ cxxopts::value<unsigned int>(ServerOptions.HttpConfig.HttpSys.AsyncWorkThreadCount),
"<httpsys workthreads>");
options.add_option("httpsys",
"",
"httpsys-enable-async-response",
"Enables Httpsys async response",
- cxxopts::value<bool>(ServerOptions.HttpServerConfig.HttpSys.IsAsyncResponseEnabled)->default_value("true"),
+ cxxopts::value<bool>(ServerOptions.HttpConfig.HttpSys.IsAsyncResponseEnabled)->default_value("true"),
"<httpsys async response>");
options.add_option("httpsys",
"",
"httpsys-enable-request-logging",
"Enables Httpsys request logging",
- cxxopts::value<bool>(ServerOptions.HttpServerConfig.HttpSys.IsRequestLoggingEnabled),
+ cxxopts::value<bool>(ServerOptions.HttpConfig.HttpSys.IsRequestLoggingEnabled),
"<httpsys request logging>");
#endif
@@ -339,7 +339,7 @@ ZenServerCmdLineOptions::AddCliOptions(cxxopts::Options& options, ZenServerConfi
"httpsys|"
#endif
"null)",
- cxxopts::value<std::string>(ServerOptions.HttpServerConfig.ServerClass)->default_value(DefaultHttp),
+ cxxopts::value<std::string>(ServerOptions.HttpConfig.ServerClass)->default_value(DefaultHttp),
"<http class>");
#if ZEN_WITH_TRACE
@@ -350,21 +350,21 @@ ZenServerCmdLineOptions::AddCliOptions(cxxopts::Options& options, ZenServerConfi
"",
"trace",
"Specify which trace channels should be enabled",
- cxxopts::value<std::string>(ServerOptions.TraceOptions.Channels)->default_value(""),
+ cxxopts::value<std::string>(ServerOptions.TraceCmdLineOptions.Channels)->default_value(""),
"");
options.add_option("ue-trace",
"",
"tracehost",
"Hostname to send the trace to",
- cxxopts::value<std::string>(ServerOptions.TraceOptions.Host)->default_value(""),
+ cxxopts::value<std::string>(ServerOptions.TraceCmdLineOptions.Host)->default_value(""),
"");
options.add_option("ue-trace",
"",
"tracefile",
"Path to write a trace to",
- cxxopts::value<std::string>(ServerOptions.TraceOptions.File)->default_value(""),
+ cxxopts::value<std::string>(ServerOptions.TraceCmdLineOptions.File)->default_value(""),
"");
#endif // ZEN_WITH_TRACE
@@ -459,7 +459,7 @@ ZenServerConfiguratorBase::Configure(int argc, char* argv[])
if (!m_ServerOptions.HasTraceCommandlineOptions)
{
// Apply any Lua settings if we don't have them set from the command line
- TraceConfigure(m_ServerOptions.TraceOptions);
+ TraceConfigure(m_ServerOptions.TraceCmdLineOptions);
}
#endif
@@ -534,7 +534,7 @@ ZenServerConfiguratorBase::Configure(int argc, char* argv[])
m_ServerOptions.AbsLogFile = m_ServerOptions.DataDir / "logs" / "zenserver.log";
}
- m_ServerOptions.HttpServerConfig.IsDedicatedServer = m_ServerOptions.IsDedicated;
+ m_ServerOptions.HttpConfig.IsDedicatedServer = m_ServerOptions.IsDedicated;
}
void
diff --git a/src/zenserver/config/config.h b/src/zenserver/config/config.h
index 467f26ee7..40639da13 100644
--- a/src/zenserver/config/config.h
+++ b/src/zenserver/config/config.h
@@ -39,7 +39,7 @@ struct ZenSentryConfig
struct ZenServerConfig
{
- HttpServerConfig HttpServerConfig;
+ HttpServerConfig HttpConfig;
ZenSentryConfig SentryConfig;
ZenStatsConfig StatsConfig;
int BasePort = 8558; // Service listen port (used for both UDP and TCP)
@@ -66,7 +66,7 @@ struct ZenServerConfig
std::string Loggers[zen::logging::level::LogLevelCount];
#if ZEN_WITH_TRACE
bool HasTraceCommandlineOptions = false;
- TraceOptions TraceOptions;
+ TraceOptions TraceCmdLineOptions;
#endif
std::string MemoryOptions; // Memory allocation options
std::string CommandLine;
diff --git a/src/zenserver/config/luaconfig.cpp b/src/zenserver/config/luaconfig.cpp
index 2c54de29e..61969019c 100644
--- a/src/zenserver/config/luaconfig.cpp
+++ b/src/zenserver/config/luaconfig.cpp
@@ -330,7 +330,6 @@ Options::Print(zen::StringBuilderBase& SB, const cxxopts::ParseResult& CmdLineRe
};
std::vector<std::string> CurrentTablePath;
std::string Indent;
- auto It = SortedKeys.begin();
for (const std::string& Key : SortedKeys)
{
std::vector<std::string> KeyPath = GetTablePath(Key);
diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp
index 43ddc14c9..6bab33d92 100644
--- a/src/zenserver/main.cpp
+++ b/src/zenserver/main.cpp
@@ -94,10 +94,10 @@ AppMain(int argc, char* argv[])
#if ZEN_WITH_TRACE
TraceInit("zenserver");
- ServerOptions.HasTraceCommandlineOptions = GetTraceOptionsFromCommandline(/* out */ ServerOptions.TraceOptions);
+ ServerOptions.HasTraceCommandlineOptions = GetTraceOptionsFromCommandline(/* out */ ServerOptions.TraceCmdLineOptions);
if (ServerOptions.HasTraceCommandlineOptions)
{
- TraceConfigure(ServerOptions.TraceOptions);
+ TraceConfigure(ServerOptions.TraceCmdLineOptions);
}
#endif // ZEN_WITH_TRACE
diff --git a/src/zenserver/storage/admin/admin.cpp b/src/zenserver/storage/admin/admin.cpp
index 68b91825d..04f43d33a 100644
--- a/src/zenserver/storage/admin/admin.cpp
+++ b/src/zenserver/storage/admin/admin.cpp
@@ -164,7 +164,7 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler,
return Req.ServerRequest().WriteResponse(HttpResponseCode::NotFound);
}
- auto WriteState = [](CbObjectWriter& Obj, const JobQueue::State& State) {
+ auto WriteState = [](CbObjectWriter& Obj, const JobQueue::JobState& State) {
if (!State.CurrentOp.empty())
{
Obj.AddString(
@@ -207,7 +207,7 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler,
switch (CurrentState->Status)
{
- case JobQueue::Status::Queued:
+ case JobQueue::JobStatus::Queued:
{
CbObjectWriter Obj;
Obj.AddString("Name"sv, CurrentState->Name);
@@ -217,7 +217,7 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler,
Req.ServerRequest().WriteResponse(HttpResponseCode::OK, Obj.Save());
}
break;
- case JobQueue::Status::Running:
+ case JobQueue::JobStatus::Running:
{
CbObjectWriter Obj;
Obj.AddString("Name"sv, CurrentState->Name);
@@ -229,7 +229,7 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler,
Req.ServerRequest().WriteResponse(HttpResponseCode::OK, Obj.Save());
}
break;
- case JobQueue::Status::Aborted:
+ case JobQueue::JobStatus::Aborted:
{
CbObjectWriter Obj;
Obj.AddString("Name"sv, CurrentState->Name);
@@ -243,7 +243,7 @@ HttpAdminService::HttpAdminService(GcScheduler& Scheduler,
Req.ServerRequest().WriteResponse(HttpResponseCode::OK, Obj.Save());
}
break;
- case JobQueue::Status::Completed:
+ case JobQueue::JobStatus::Completed:
{
CbObjectWriter Obj;
Obj.AddString("Name"sv, CurrentState->Name);
diff --git a/src/zenserver/storage/buildstore/httpbuildstore.cpp b/src/zenserver/storage/buildstore/httpbuildstore.cpp
index e5ea23acc..18fae7027 100644
--- a/src/zenserver/storage/buildstore/httpbuildstore.cpp
+++ b/src/zenserver/storage/buildstore/httpbuildstore.cpp
@@ -199,6 +199,8 @@ HttpBuildStoreService::PutMetadataRequest(HttpRouterRequest& Req)
std::string_view Bucket = Req.GetCapture(2);
std::string_view BuildId = Req.GetCapture(3);
+ ZEN_UNUSED(Namespace, Bucket, BuildId);
+
IoBuffer MetaPayload = ServerRequest.ReadPayload();
if (MetaPayload.GetContentType() != ZenContentType::kCbPackage)
{
diff --git a/src/zenserver/storage/storageconfig.cpp b/src/zenserver/storage/storageconfig.cpp
index 61844140e..3a41ad003 100644
--- a/src/zenserver/storage/storageconfig.cpp
+++ b/src/zenserver/storage/storageconfig.cpp
@@ -41,7 +41,7 @@ ZenStorageServerConfigurator::ValidateOptions()
throw OptionParseException(fmt::format("'--encryption-aes-iv' ('{}') is malformed", ServerOptions.EncryptionIV), {});
}
}
- if (ServerOptions.HttpServerConfig.ForceLoopback && ServerOptions.IsDedicated)
+ if (ServerOptions.HttpConfig.ForceLoopback && ServerOptions.IsDedicated)
{
throw OptionParseException("'--dedicated' conflicts with '--http-forceloopback'", {});
}
@@ -602,7 +602,7 @@ ZenStorageServerConfigurator::ParsePluginsConfigFile(const std::filesystem::path
Config.PluginOptions.push_back({"port", std::to_string(m_ServerOptions.BasePort)});
}
- m_ServerOptions.HttpServerConfig.PluginConfigs.push_back(Config);
+ m_ServerOptions.HttpConfig.PluginConfigs.push_back(Config);
}
}
diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp
index 2dd51d243..787f28693 100644
--- a/src/zenserver/zenserver.cpp
+++ b/src/zenserver/zenserver.cpp
@@ -124,12 +124,12 @@ ZenServerBase::Initialize(const ZenServerConfig& ServerOptions, ZenServerState::
EnqueueSigIntTimer();
- m_Http = CreateHttpServer(ServerOptions.HttpServerConfig);
+ m_Http = CreateHttpServer(ServerOptions.HttpConfig);
int EffectiveBasePort = m_Http->Initialize(ServerOptions.BasePort, ServerOptions.DataDir);
if (EffectiveBasePort == 0)
{
ZEN_WARN("Failed to initialize http service '{}' using base port {} and data dir '{}'",
- ServerOptions.HttpServerConfig.ServerClass,
+ ServerOptions.HttpConfig.ServerClass,
ServerOptions.BasePort,
ServerOptions.DataDir);
return -1;