diff options
| author | Per Larsson <[email protected]> | 2021-09-07 10:26:22 +0200 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-09-07 10:26:22 +0200 |
| commit | c5dd3d32cb29ac963f61eb6c119d54ed14f94f9a (patch) | |
| tree | 57a04246635577f11a35bb9a670610d508e694e8 | |
| parent | Added custom cpr::Response formatter and removed duplicate logging code. (diff) | |
| parent | Clarified some async/sync behaviour in HTTP implementation (diff) | |
| download | zen-c5dd3d32cb29ac963f61eb6c119d54ed14f94f9a.tar.xz zen-c5dd3d32cb29ac963f61eb6c119d54ed14f94f9a.zip | |
Merge branch 'main' of https://github.com/EpicGames/zen
| -rw-r--r-- | xmake.lua | 35 | ||||
| -rw-r--r-- | zen/xmake.lua | 3 | ||||
| -rw-r--r-- | zencore-test/xmake.lua | 3 | ||||
| -rw-r--r-- | zencore/crc32.cpp | 2 | ||||
| -rw-r--r-- | zencore/include/zencore/httpserver.h | 3 | ||||
| -rw-r--r-- | zencore/include/zencore/memory.h | 2 | ||||
| -rw-r--r-- | zencore/xmake.lua | 12 | ||||
| -rw-r--r-- | zenserver-test/xmake.lua | 1 | ||||
| -rw-r--r-- | zenserver-test/zenserver-test.cpp | 8 | ||||
| -rw-r--r-- | zenserver/vfs.cpp | 26 | ||||
| -rw-r--r-- | zenserver/vfs.h | 2 | ||||
| -rw-r--r-- | zenserver/xmake.lua | 9 | ||||
| -rw-r--r-- | zenserver/zenserver.cpp | 30 |
13 files changed, 99 insertions, 37 deletions
@@ -1,8 +1,26 @@ -add_requires("vcpkg::doctest", "vcpkg::spdlog", "vcpkg::gsl-lite", "vcpkg::asio", "vcpkg::cpr", "vcpkg::xxhash", "vcpkg::robin-map", "vcpkg::lz4", "vcpkg::fmt") -add_requires("vcpkg::cxxopts", "vcpkg::mimalloc", "vcpkg::sol2", "vcpkg::sentry-native", "vcpkg::json11") -add_requires("vcpkg::lua", "vcpkg::curl", "vcpkg::zlib", "vcpkg::zstd", "vcpkg::http-parser") +add_requires( + "vcpkg::doctest", + "vcpkg::spdlog", + "vcpkg::gsl-lite", + "vcpkg::asio", + "vcpkg::cpr", + "vcpkg::xxhash", + "vcpkg::robin-map", + "vcpkg::lz4", + "vcpkg::fmt", + "vcpkg::cxxopts", + "vcpkg::mimalloc", + "vcpkg::sol2", + "vcpkg::sentry-native", + "vcpkg::json11", + "vcpkg::lua", + "vcpkg::curl", + "vcpkg::zlib", + "vcpkg::zstd", + "vcpkg::http-parser") add_rules("mode.debug", "mode.release") + if is_mode("release") then set_optimize("smallest") if is_plat("windows") then @@ -14,22 +32,21 @@ if is_mode("debug") then add_defines("DEBUG") end -add_defines("UNICODE") -add_linkdirs("$(projectdir)/3rdparty/BLAKE3/lib/Win64", "$(projectdir)/3rdparty/Oodle/lib/Win64") +add_defines("UNICODE", "_CONSOLE") set_warnings("allextra", "error") set_languages("cxx20") set_symbols("debug") -add_packages("vcpkg::doctest", "vcpkg::spdlog", "vcpkg::gsl-lite", "vcpkg::asio", "vcpkg::cpr", "vcpkg::xxhash", "vcpkg::robin-map", "vcpkg::lz4", "vcpkg::fmt") -add_packages("vcpkg::cxxopts", "vcpkg::mimalloc", "vcpkg::sol2", "vcpkg::sentry-native", "vcpkg::json11") -add_packages("vcpkg::lua", "vcpkg::curl", "vcpkg::zlib", "vcpkg::zstd", "vcpkg::http-parser") +add_packages( + "vcpkg::cxxopts", + "vcpkg::mimalloc") includes("zencore/xmake.lua") +includes("zencore-test/xmake.lua") includes("zenstore/xmake.lua") includes("zenutil/xmake.lua") -includes("zencore-test/xmake.lua") includes("zenserver/xmake.lua") includes("zenserver-test/xmake.lua") includes("zen/xmake.lua") diff --git a/zen/xmake.lua b/zen/xmake.lua index 4dc1307d0..6f574df74 100644 --- a/zen/xmake.lua +++ b/zen/xmake.lua @@ -13,4 +13,5 @@ target("zen") add_ldflags("/subsystem:console,5.02") add_ldflags("/LTCG") end -
\ No newline at end of file + + add_packages("vcpkg::zstd") diff --git a/zencore-test/xmake.lua b/zencore-test/xmake.lua index e335cad37..61421f292 100644 --- a/zencore-test/xmake.lua +++ b/zencore-test/xmake.lua @@ -1,7 +1,4 @@ target("zencore-test") set_kind("binary") add_files("*.cpp") - add_includedirs("..\\3rdparty\\utfcpp\\source") add_deps("zencore") - add_links("BLAKE3") - set_symbols("debug") diff --git a/zencore/crc32.cpp b/zencore/crc32.cpp index cd381d49f..d4a3cac57 100644 --- a/zencore/crc32.cpp +++ b/zencore/crc32.cpp @@ -418,7 +418,7 @@ static const uint32_t CRCTablesSB8[8][256] = { 0xbd4e1337, 0x71e413a9, 0x7b211ab0, 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, 0x264b06e6}}; -#define BYTESWAP_ORDER32(x) (((x) >> 24) + (((x) >> 8) & 0xff00) + (((x) << 8) & 0xff0000) + ((x) << 24)) +#define BYTESWAP_ORDER32(x) (((x) >> 24) + (((x) >> 8) & 0xff00) + (((x) << 8) & 0xff0000) + ((x) << 24)) #define UE_PTRDIFF_TO_UINT32(argument) static_cast<uint32_t>(argument) template<typename T> diff --git a/zencore/include/zencore/httpserver.h b/zencore/include/zencore/httpserver.h index 2158f87a8..d4d9e21e0 100644 --- a/zencore/include/zencore/httpserver.h +++ b/zencore/include/zencore/httpserver.h @@ -222,6 +222,9 @@ public: This will return a null buffer if the contents are not fully available yet, and the handler should at that point return - another completion request will be issued once the contents have been received fully. + + NOTE: in practice, via the http.sys implementation this always operates synchronously. This should + be updated to provide fully asynchronous operation for better scalability on shared instances */ virtual IoBuffer ReadPayload() = 0; diff --git a/zencore/include/zencore/memory.h b/zencore/include/zencore/memory.h index 040f97025..5a324955d 100644 --- a/zencore/include/zencore/memory.h +++ b/zencore/include/zencore/memory.h @@ -53,7 +53,7 @@ public: inline void Free(void* Ptr) { ZEN_UNUSED(Ptr); /* no-op */ } ChunkingLinearAllocator(const ChunkingLinearAllocator&) = delete; - ChunkingLinearAllocator&operator=(const ChunkingLinearAllocator&) = delete; + ChunkingLinearAllocator& operator=(const ChunkingLinearAllocator&) = delete; private: uint8_t* m_ChunkCursor = nullptr; diff --git a/zencore/xmake.lua b/zencore/xmake.lua index 39eb4590e..5de7f476d 100644 --- a/zencore/xmake.lua +++ b/zencore/xmake.lua @@ -3,4 +3,14 @@ target('zencore') add_files("**.cpp") add_includedirs("include", {public=true}) add_includedirs("..\\3rdparty\\utfcpp\\source") - + add_linkdirs("$(projectdir)/3rdparty/BLAKE3/lib/Win64", "$(projectdir)/3rdparty/Oodle/lib/Win64") + add_packages( + "vcpkg::spdlog", + "vcpkg::fmt", + "vcpkg::doctest", + "vcpkg::lz4", + "vcpkg::cpr", + "vcpkg::curl", -- required by cpr + "vcpkg::zlib", -- required by curl + "vcpkg::xxhash", + "vcpkg::gsl-lite") diff --git a/zenserver-test/xmake.lua b/zenserver-test/xmake.lua index aa83c3e38..a7d696959 100644 --- a/zenserver-test/xmake.lua +++ b/zenserver-test/xmake.lua @@ -2,3 +2,4 @@ target("zenserver-test") set_kind("binary") add_files("*.cpp") add_deps("zencore", "zenutil") + add_packages("vcpkg::http-parser") diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp index 008cae27e..455ab2495 100644 --- a/zenserver-test/zenserver-test.cpp +++ b/zenserver-test/zenserver-test.cpp @@ -89,7 +89,7 @@ public: void Get(const std::string_view Server, int Port, const std::string_view Path) { ZEN_UNUSED(Port); - + http_parser_init(&m_HttpParser, HTTP_RESPONSE); m_HttpParser.data = this; @@ -152,7 +152,11 @@ private: return 0; } int OnMessageBegin() { return 0; } - int OnBody(const char* Data, size_t Bytes) { ZEN_UNUSED(Data, Bytes); return 0; } + int OnBody(const char* Data, size_t Bytes) + { + ZEN_UNUSED(Data, Bytes); + return 0; + } void OnConnected() { diff --git a/zenserver/vfs.cpp b/zenserver/vfs.cpp index 71f0bbdda..5b6a3e4b6 100644 --- a/zenserver/vfs.cpp +++ b/zenserver/vfs.cpp @@ -2,19 +2,20 @@ #include "vfs.h" -#include <zencore/except.h> -#include <zencore/filesystem.h> -#include <zencore/snapshot_manifest.h> -#include <zencore/stream.h> -#include <zencore/windows.h> +#if WITH_VFS +# include <zencore/except.h> +# include <zencore/filesystem.h> +# include <zencore/snapshot_manifest.h> +# include <zencore/stream.h> +# include <zencore/windows.h> -#include <map> +# include <map> -#include <atlfile.h> -#include <projectedfslib.h> -#include <spdlog/spdlog.h> +# include <atlfile.h> +# include <projectedfslib.h> +# include <spdlog/spdlog.h> -#pragma comment(lib, "projectedfslib.lib") +# pragma comment(lib, "projectedfslib.lib") namespace zen { @@ -472,9 +473,9 @@ ProjfsProvider::DebugPrint(const char* FmtString, ...) va_list vl; va_start(vl, FmtString); -#if 0 +# if 0 vprintf(FmtString, vl); -#endif +# endif va_end(vl); } @@ -896,3 +897,4 @@ Vfs::Stop() } } // namespace zen +#endif
\ No newline at end of file diff --git a/zenserver/vfs.h b/zenserver/vfs.h index e77ff381b..4b7c5e30a 100644 --- a/zenserver/vfs.h +++ b/zenserver/vfs.h @@ -2,6 +2,7 @@ #pragma once +#if WITH_VFS #include <zencore/httpserver.h> #include <zenstore/CAS.h> @@ -29,3 +30,4 @@ private: }; } // namespace zen +#endif diff --git a/zenserver/xmake.lua b/zenserver/xmake.lua index 5c994a3a7..8319dedec 100644 --- a/zenserver/xmake.lua +++ b/zenserver/xmake.lua @@ -15,4 +15,11 @@ target("zenserver") add_ldflags("/MANIFESTUAC:level='requireAdministrator'") add_ldflags("/LTCG") end -
\ No newline at end of file + + add_packages( + "vcpkg::sentry-native", + "vcpkg::sol2", + "vcpkg::lua", + "vcpkg::asio", + "vcpkg::json11" + )
\ No newline at end of file diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index e465734e0..c857d4c71 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -40,12 +40,26 @@ #include "config.h" #include "diag/logging.h" -#define SENTRY_BUILD_STATIC 1 -#include <sentry.h> -#pragma comment(lib, "sentry.lib") -#pragma comment(lib, "dbghelp.lib") -#pragma comment(lib, "winhttp.lib") -#pragma comment(lib, "version.lib") +////////////////////////////////////////////////////////////////////////// +// Sentry +// + +#define USE_SENTRY 1 + +#if USE_SENTRY +# define SENTRY_BUILD_STATIC 1 +# include <sentry.h> + +// Sentry currently does not automatically add all required Windows +// libraries to the linker when consumed via vcpkg + +# if ZEN_PLATFORM_WINDOWS +# pragma comment(lib, "sentry.lib") +# pragma comment(lib, "dbghelp.lib") +# pragma comment(lib, "winhttp.lib") +# pragma comment(lib, "version.lib") +# endif +#endif ////////////////////////////////////////////////////////////////////////// // Services @@ -261,7 +275,9 @@ public: spdlog::info(ZEN_APP_NAME " now running"); +#if USE_SENTRY sentry_clear_modulecache(); +#endif if (m_DebugOptionForcedCrash) { @@ -373,6 +389,7 @@ main(int argc, char* argv[]) ParseGlobalCliOptions(argc, argv, GlobalOptions, ServiceConfig); InitializeLogging(GlobalOptions); +#if USE_SENTRY // Initialize sentry.io client sentry_options_t* SentryOptions = sentry_options_new(); @@ -380,6 +397,7 @@ main(int argc, char* argv[]) sentry_init(SentryOptions); auto _ = zen::MakeGuard([&] { sentry_close(); }); +#endif // Prototype config system, let's see how this pans out |