diff options
| author | Stefan Boberg <[email protected]> | 2026-03-16 10:56:11 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-16 10:56:11 +0100 |
| commit | 8c3ba4e8c522d119df3cb48966e36c0eaa80aeb9 (patch) | |
| tree | cf51b07e097904044b4bf65bc3fe0ad14134074f /src/zenserver | |
| parent | Merge branch 'sb/no-network' of https://github.ol.epicgames.net/ue-foundation... (diff) | |
| parent | Enable cross compilation of Windows targets on Linux (#839) (diff) | |
| download | zen-sb/no-network.tar.xz zen-sb/no-network.zip | |
Merge branch 'main' into sb/no-networksb/no-network
Diffstat (limited to 'src/zenserver')
| -rw-r--r-- | src/zenserver/compute/computeserver.cpp | 2 | ||||
| -rw-r--r-- | src/zenserver/config/config.cpp | 10 | ||||
| -rw-r--r-- | src/zenserver/frontend/html.zip | bin | 431365 -> 0 bytes | |||
| -rw-r--r-- | src/zenserver/hub/zenhubserver.cpp | 2 | ||||
| -rw-r--r-- | src/zenserver/proxy/zenproxyserver.cpp | 2 | ||||
| -rw-r--r-- | src/zenserver/storage/objectstore/objectstore.cpp | 11 | ||||
| -rw-r--r-- | src/zenserver/storage/vfs/vfsservice.cpp | 2 | ||||
| -rw-r--r-- | src/zenserver/storage/zenstorageserver.cpp | 2 | ||||
| -rw-r--r-- | src/zenserver/targetver.h | 2 | ||||
| -rw-r--r-- | src/zenserver/xmake.lua | 58 | ||||
| -rw-r--r-- | src/zenserver/zenserver.cpp | 26 | ||||
| -rw-r--r-- | src/zenserver/zenserver.h | 5 | ||||
| -rw-r--r-- | src/zenserver/zenserver.rc | 2 |
13 files changed, 98 insertions, 26 deletions
diff --git a/src/zenserver/compute/computeserver.cpp b/src/zenserver/compute/computeserver.cpp index a02ca7be3..0d8550c5b 100644 --- a/src/zenserver/compute/computeserver.cpp +++ b/src/zenserver/compute/computeserver.cpp @@ -865,7 +865,7 @@ ZenComputeServer::Run() ExtendableStringBuilder<256> BuildOptions; GetBuildOptions(BuildOptions, '\n'); - ZEN_INFO("Build options ({}/{}):\n{}", GetOperatingSystemName(), GetCpuName(), BuildOptions); + ZEN_INFO("Build options ({}/{}, {}):\n{}", GetOperatingSystemName(), GetCpuName(), GetCompilerName(), BuildOptions); } ZEN_INFO(ZEN_APP_NAME " now running as COMPUTE (pid: {})", GetCurrentProcessId()); diff --git a/src/zenserver/config/config.cpp b/src/zenserver/config/config.cpp index c550b174c..60ae93853 100644 --- a/src/zenserver/config/config.cpp +++ b/src/zenserver/config/config.cpp @@ -201,6 +201,7 @@ struct ZenServerCmdLineOptions std::string DataDir; std::string BaseSnapshotDir; std::string SecurityConfigPath; + std::string UnixSocketPath; std::string PortStr; ZenLoggingCmdLineOptions LoggingOptions; @@ -320,7 +321,7 @@ ZenServerCmdLineOptions::AddCliOptions(cxxopts::Options& options, ZenServerConfi "", "unix-socket", "Unix domain socket path to listen on (in addition to TCP)", - cxxopts::value<std::string>(ServerOptions.HttpConfig.UnixSocketPath), + cxxopts::value<std::string>(UnixSocketPath), "<path>"); options.add_option("network", @@ -413,7 +414,7 @@ ZenServerCmdLineOptions::AddCliOptions(cxxopts::Options& options, ZenServerConfi "", "httpclient", "Select HTTP client implementation (e.g. 'curl', 'cpr')", - cxxopts::value<std::string>(ServerOptions.HttpClient.Backend)->default_value("cpr"), + cxxopts::value<std::string>(ServerOptions.HttpClient.Backend)->default_value("curl"), "<http client>"); options.add_option("network", @@ -480,6 +481,11 @@ ZenServerCmdLineOptions::ApplyOptions(cxxopts::Options& options, ZenServerConfig ServerOptions.BaseSnapshotDir = MakeSafeAbsolutePath(BaseSnapshotDir); ServerOptions.SecurityConfigPath = MakeSafeAbsolutePath(SecurityConfigPath); + if (!UnixSocketPath.empty()) + { + ServerOptions.HttpConfig.UnixSocketPath = MakeSafeAbsolutePath(UnixSocketPath); + } + if (PortStr != "auto") { int Port = 0; diff --git a/src/zenserver/frontend/html.zip b/src/zenserver/frontend/html.zip Binary files differdeleted file mode 100644 index 58778a592..000000000 --- a/src/zenserver/frontend/html.zip +++ /dev/null diff --git a/src/zenserver/hub/zenhubserver.cpp b/src/zenserver/hub/zenhubserver.cpp index 696991403..b0ae0a8b1 100644 --- a/src/zenserver/hub/zenhubserver.cpp +++ b/src/zenserver/hub/zenhubserver.cpp @@ -337,7 +337,7 @@ ZenHubServer::Run() ExtendableStringBuilder<256> BuildOptions; GetBuildOptions(BuildOptions, '\n'); - ZEN_INFO("Build options ({}/{}):\n{}", GetOperatingSystemName(), GetCpuName(), BuildOptions); + ZEN_INFO("Build options ({}/{}, {}):\n{}", GetOperatingSystemName(), GetCpuName(), GetCompilerName(), BuildOptions); } ZEN_INFO(ZEN_APP_NAME " now running as HUB (pid: {})", GetCurrentProcessId()); diff --git a/src/zenserver/proxy/zenproxyserver.cpp b/src/zenserver/proxy/zenproxyserver.cpp index acfdad45f..c768e940a 100644 --- a/src/zenserver/proxy/zenproxyserver.cpp +++ b/src/zenserver/proxy/zenproxyserver.cpp @@ -359,7 +359,7 @@ ZenProxyServer::Run() ExtendableStringBuilder<256> BuildOptions; GetBuildOptions(BuildOptions, '\n'); - ZEN_INFO("Build options ({}/{}):\n{}", GetOperatingSystemName(), GetCpuName(), BuildOptions); + ZEN_INFO("Build options ({}/{}, {}):\n{}", GetOperatingSystemName(), GetCpuName(), GetCompilerName(), BuildOptions); } ZEN_INFO(ZEN_APP_NAME " now running as PROXY (pid: {})", GetCurrentProcessId()); diff --git a/src/zenserver/storage/objectstore/objectstore.cpp b/src/zenserver/storage/objectstore/objectstore.cpp index 052c3d630..e347e2dfe 100644 --- a/src/zenserver/storage/objectstore/objectstore.cpp +++ b/src/zenserver/storage/objectstore/objectstore.cpp @@ -271,7 +271,7 @@ HttpObjectStoreService::Inititalize() CreateDirectories(BucketsPath); } - static constexpr AsciiSet ValidPathCharactersSet{"abcdefghijklmnopqrstuvwxyz0123456789/_.,;$~{}+-[]%()]ABCDEFGHIJKLMNOPQRSTUVWXYZ"}; + static constexpr AsciiSet ValidPathCharactersSet{"abcdefghijklmnopqrstuvwxyz0123456789/_.,;$~{}+-[]() ABCDEFGHIJKLMNOPQRSTUVWXYZ"}; static constexpr AsciiSet ValidBucketCharactersSet{"abcdefghijklmnopqrstuvwxyz0123456789-_.ABCDEFGHIJKLMNOPQRSTUVWXYZ"}; m_Router.AddMatcher("path", @@ -292,10 +292,9 @@ HttpObjectStoreService::Inititalize() m_Router.RegisterRoute( "bucket/{path}", [this](zen::HttpRouterRequest& Request) { - const std::string_view EncodedPath = Request.GetCapture(1); - const std::string Path = Request.ServerRequest().Decode(EncodedPath); - const auto Sep = Path.find_last_of('.'); - const bool IsObject = Sep != std::string::npos && Path.size() - Sep > 0; + const std::string_view Path = Request.GetCapture(1); + const auto Sep = Path.find_last_of('.'); + const bool IsObject = Sep != std::string_view::npos && Path.size() - Sep > 0; if (IsObject) { @@ -378,7 +377,7 @@ HttpObjectStoreService::ListBucket(zen::HttpRouterRequest& Request, const std::s const auto QueryParms = Request.ServerRequest().GetQueryParams(); if (auto PrefixParam = QueryParms.GetValue("prefix"); PrefixParam.empty() == false) { - BucketPrefix = PrefixParam; + BucketPrefix = HttpServerRequest::Decode(PrefixParam); } } BucketPrefix.erase(0, BucketPrefix.find_first_not_of('/')); diff --git a/src/zenserver/storage/vfs/vfsservice.cpp b/src/zenserver/storage/vfs/vfsservice.cpp index 863ec348a..f418c4131 100644 --- a/src/zenserver/storage/vfs/vfsservice.cpp +++ b/src/zenserver/storage/vfs/vfsservice.cpp @@ -62,7 +62,7 @@ GetContentAsCbObject(HttpServerRequest& HttpReq, CbObject& Cb) // echo {"method": "mount", "params": {"path": "d:\\VFS_ROOT"}} | curl.exe http://localhost:8558/vfs --data-binary @- // echo {"method": "unmount"} | curl.exe http://localhost:8558/vfs --data-binary @- -VfsService::VfsService(HttpStatusService& StatusService, VfsServiceImpl* ServiceImpl) : m_StatusService(StatusService), m_Impl(ServiceImpl) +VfsService::VfsService(HttpStatusService& StatusService, VfsServiceImpl* ServiceImpl) : m_Impl(ServiceImpl), m_StatusService(StatusService) { m_Router.RegisterRoute( "info", diff --git a/src/zenserver/storage/zenstorageserver.cpp b/src/zenserver/storage/zenstorageserver.cpp index 77588bd6c..bba5e0a61 100644 --- a/src/zenserver/storage/zenstorageserver.cpp +++ b/src/zenserver/storage/zenstorageserver.cpp @@ -720,7 +720,7 @@ ZenStorageServer::Run() ExtendableStringBuilder<256> BuildOptions; GetBuildOptions(BuildOptions, '\n'); - ZEN_INFO("Build options ({}/{}):\n{}", GetOperatingSystemName(), GetCpuName(), BuildOptions); + ZEN_INFO("Build options ({}/{}, {}):\n{}", GetOperatingSystemName(), GetCpuName(), GetCompilerName(), BuildOptions); } ZEN_INFO(ZEN_APP_NAME " now running (pid: {})", GetCurrentProcessId()); diff --git a/src/zenserver/targetver.h b/src/zenserver/targetver.h index d432d6993..4805141de 100644 --- a/src/zenserver/targetver.h +++ b/src/zenserver/targetver.h @@ -7,4 +7,4 @@ // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. -#include <SDKDDKVer.h> +#include <sdkddkver.h> diff --git a/src/zenserver/xmake.lua b/src/zenserver/xmake.lua index 3cfaa956d..6b29dadfb 100644 --- a/src/zenserver/xmake.lua +++ b/src/zenserver/xmake.lua @@ -12,12 +12,14 @@ target("zenserver") "zenremotestore", "zenstore", "zentelemetry", - "zenutil", - "zenvfs") + "zenutil") + if is_plat("windows") then + add_deps("zenvfs") + end add_headerfiles("**.h") add_rules("utils.bin2c", {extensions = {".zip"}}) add_files("**.cpp") - add_files("frontend/*.zip") + add_files("frontend/html.zip") add_files("zenserver.cpp", {unity_ignored = true }) if is_plat("linux") and not (get_config("toolchain") or ""):find("clang") then @@ -58,13 +60,15 @@ target("zenserver") end if is_plat("windows") then - add_ldflags("/subsystem:console,5.02") - add_ldflags("/MANIFEST:EMBED") - add_ldflags("/LTCG") + add_ldflags("/subsystem:console,5.02", {force = true}) + add_ldflags("/MANIFEST:EMBED", {force = true}) + if not (get_config("toolchain") or ""):find("clang") then + add_ldflags("/LTCG") + end add_files("zenserver.rc") add_cxxflags("/bigobj") add_links("delayimp", "projectedfslib") - add_ldflags("/delayload:ProjectedFSLib.dll") + add_ldflags("/delayload:ProjectedFSLib.dll", {force = true}) else remove_files("windows/**") end @@ -78,7 +82,45 @@ target("zenserver") add_ldflags("-framework SystemConfiguration") end - -- to work around some unfortunate Ctrl-C behaviour on Linux/Mac due to + on_load(function(target) + local html_dir = path.join(os.projectdir(), "src/zenserver/frontend/html") + local zip_path = path.join(os.projectdir(), "src/zenserver/frontend/html.zip") + + -- Check if zip needs regeneration + local need_update = not os.isfile(zip_path) + if not need_update then + local zip_mtime = os.mtime(zip_path) + for _, file in ipairs(os.files(path.join(html_dir, "**"))) do + if os.mtime(file) > zip_mtime then + need_update = true + break + end + end + end + + if need_update then + print("Regenerating frontend zip...") + os.tryrm(zip_path) + + import("detect.tools.find_7z") + local cmd_7z = find_7z() + if cmd_7z then + os.execv(cmd_7z, {"a", "-mx0", zip_path, path.join(html_dir, ".")}) + else + import("detect.tools.find_zip") + local zip_cmd = find_zip() + if zip_cmd then + local oldir = os.cd(html_dir) + os.execv(zip_cmd, {"-r", "-0", zip_path, "."}) + os.cd(oldir) + else + raise("Unable to find a suitable zip tool (need 7z or zip)") + end + end + end + end) + + -- to work around some unfortunate Ctrl-C behaviour on Linux/Mac due to -- our use of setsid() at startup we pass in `--no-detach` to zenserver -- ensure that it recieves signals when the user requests termination on_run(function(target) diff --git a/src/zenserver/zenserver.cpp b/src/zenserver/zenserver.cpp index 8283f0cbe..6760e0372 100644 --- a/src/zenserver/zenserver.cpp +++ b/src/zenserver/zenserver.cpp @@ -201,6 +201,9 @@ ZenServerBase::Initialize(const ZenServerConfig& ServerOptions, ZenServerState:: std::chrono::system_clock::now().time_since_epoch()).count(), .BuildOptions = { {"ZEN_ADDRESS_SANITIZER", ZEN_ADDRESS_SANITIZER != 0}, + {"ZEN_THREAD_SANITIZER", ZEN_THREAD_SANITIZER != 0}, + {"ZEN_MEMORY_SANITIZER", ZEN_MEMORY_SANITIZER != 0}, + {"ZEN_LEAK_SANITIZER", ZEN_LEAK_SANITIZER != 0}, {"ZEN_USE_SENTRY", ZEN_USE_SENTRY != 0}, {"ZEN_WITH_TESTS", ZEN_WITH_TESTS != 0}, {"ZEN_USE_MIMALLOC", ZEN_USE_MIMALLOC != 0}, @@ -251,6 +254,12 @@ ZenServerBase::GetBuildOptions(StringBuilderBase& OutOptions, char Separator) co OutOptions << "ZEN_ADDRESS_SANITIZER=" << (ZEN_ADDRESS_SANITIZER ? "1" : "0"); OutOptions << Separator; + OutOptions << "ZEN_THREAD_SANITIZER=" << (ZEN_THREAD_SANITIZER ? "1" : "0"); + OutOptions << Separator; + OutOptions << "ZEN_MEMORY_SANITIZER=" << (ZEN_MEMORY_SANITIZER ? "1" : "0"); + OutOptions << Separator; + OutOptions << "ZEN_LEAK_SANITIZER=" << (ZEN_LEAK_SANITIZER ? "1" : "0"); + OutOptions << Separator; OutOptions << "ZEN_USE_SENTRY=" << (ZEN_USE_SENTRY ? "1" : "0"); OutOptions << Separator; OutOptions << "ZEN_WITH_TESTS=" << (ZEN_WITH_TESTS ? "1" : "0"); @@ -726,6 +735,20 @@ ZenServerMain::Run() Entry = ServerState.Register(m_ServerOptions.BasePort); + // Publish per-instance extended info (e.g. UDS path) via a small shared memory + // section keyed by SessionId so clients can discover it during Snapshot() enumeration. + { + InstanceInfoData InstanceData; + InstanceData.UnixSocketPath = m_ServerOptions.HttpConfig.UnixSocketPath; + m_InstanceInfo.Create(GetSessionId(), InstanceData); + Entry->SignalHasInstanceInfo(); + } + + if (m_ServerOptions.HttpConfig.NoNetwork) + { + Entry->SignalNoNetwork(); + } + if (m_ServerOptions.OwnerPid) { // We are adding a sponsor process to our own entry, can't wait for pick since the code is not run until later @@ -786,7 +809,8 @@ ZenServerMain::MakeLockData(bool IsReady) .EffectiveListenPort = gsl::narrow<uint16_t>(m_ServerOptions.BasePort), .Ready = IsReady, .DataDir = m_ServerOptions.DataDir, - .ExecutablePath = GetRunningExecutablePath()}); + .ExecutablePath = GetRunningExecutablePath(), + .UnixSocketPath = m_ServerOptions.HttpConfig.UnixSocketPath}); }; } // namespace zen diff --git a/src/zenserver/zenserver.h b/src/zenserver/zenserver.h index 374184aa9..830f36e54 100644 --- a/src/zenserver/zenserver.h +++ b/src/zenserver/zenserver.h @@ -148,8 +148,9 @@ public: ZenServerMain& operator=(const ZenServerMain&) = delete; protected: - ZenServerConfig& m_ServerOptions; - LockFile m_LockFile; + ZenServerConfig& m_ServerOptions; + LockFile m_LockFile; + ZenServerInstanceInfo m_InstanceInfo; virtual void InitializeLogging(); virtual void DoRun(ZenServerState::ZenServerEntry* Entry) = 0; diff --git a/src/zenserver/zenserver.rc b/src/zenserver/zenserver.rc index f353bd9cc..abe1acf71 100644 --- a/src/zenserver/zenserver.rc +++ b/src/zenserver/zenserver.rc @@ -28,7 +28,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_ICON1 ICON "..\\zen.ico" +IDI_ICON1 ICON "../zen.ico" #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// |