aboutsummaryrefslogtreecommitdiff
path: root/zenserver/zenserver.cpp
diff options
context:
space:
mode:
authorPer Larsson <[email protected]>2022-01-11 10:31:34 +0100
committerPer Larsson <[email protected]>2022-01-11 10:31:34 +0100
commitfa40b11e35f9791bd6ca472ef7bfc246eecbd696 (patch)
tree058c1dcef54eb3c15eedc12b29f24d72db239d52 /zenserver/zenserver.cpp
parentAdded option to disable Sentry crash handler. (diff)
parentNot all toolchains support C++20's atomic<double>::fetch_add() (diff)
downloadzen-fa40b11e35f9791bd6ca472ef7bfc246eecbd696.tar.xz
zen-fa40b11e35f9791bd6ca472ef7bfc246eecbd696.zip
Merged main.
Diffstat (limited to 'zenserver/zenserver.cpp')
-rw-r--r--zenserver/zenserver.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index 77f7a3d64..e6cb95a7b 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -114,7 +114,6 @@ ZEN_THIRD_PARTY_INCLUDES_END
namespace zen {
using namespace std::literals;
-using namespace fmt::literals;
namespace utils {
asio::error_code ResolveHostname(asio::io_context& Ctx,
@@ -139,7 +138,7 @@ namespace utils {
{
for (const asio::ip::tcp::endpoint Ep : Endpoints)
{
- OutEndpoints.push_back("http://{}:{}"_format(Ep.address().to_string(), Ep.port()));
+ OutEndpoints.push_back(fmt::format("http://{}:{}", Ep.address().to_string(), Ep.port()));
}
}
@@ -152,8 +151,6 @@ class ZenServer : public IHttpStatusProvider
public:
void Initialize(const ZenServerOptions& ServerOptions, ZenServerState::ZenServerEntry* ServerEntry)
{
- using namespace fmt::literals;
-
m_UseSentry = ServerOptions.NoSentry == false;
m_ServerEntry = ServerEntry;
m_DebugOptionForcedCrash = ServerOptions.ShouldCrash;
@@ -181,11 +178,11 @@ public:
// Initialize/check mutex based on base port
- std::string MutexName = "zen_{}"_format(ServerOptions.BasePort);
+ std::string MutexName = fmt::format("zen_{}", ServerOptions.BasePort);
if (zen::NamedMutex::Exists(MutexName) || ((m_ServerMutex.Create(MutexName) == false)))
{
- throw std::runtime_error("Failed to create mutex '{}' - is another instance already running?"_format(MutexName).c_str());
+ throw std::runtime_error(fmt::format("Failed to create mutex '{}' - is another instance already running?", MutexName).c_str());
}
InitializeState(ServerOptions);
@@ -369,6 +366,7 @@ public:
ZEN_INFO(ZEN_APP_NAME " exiting");
m_IoContext.stop();
+ m_IoRunner.join();
Flush();
}
@@ -394,7 +392,7 @@ public:
{
if (!m_IoRunner.joinable())
{
- m_IoRunner = std::move(std::jthread{[this] { m_IoContext.run(); }});
+ m_IoRunner = std::thread{[this] { m_IoContext.run(); }};
}
}
@@ -490,7 +488,7 @@ private:
CbObject m_RootManifest;
std::filesystem::path m_DataRoot;
std::filesystem::path m_ContentRoot;
- std::jthread m_IoRunner;
+ std::thread m_IoRunner;
asio::io_context m_IoContext;
asio::steady_timer m_PidCheckTimer{m_IoContext};
zen::ProcessMonitor m_ProcessMonitor;
@@ -591,7 +589,7 @@ ZenServer::InitializeState(const ZenServerOptions& ServerOptions)
else
{
WipeState = true;
- WipeReason = "No manifest present at '{}'"_format(ManifestPath);
+ WipeReason = fmt::format("No manifest present at '{}'", ManifestPath);
}
}
else
@@ -601,10 +599,10 @@ ZenServer::InitializeState(const ZenServerOptions& ServerOptions)
if (CbValidateError ValidationResult = ValidateCompactBinary(Manifest, CbValidateMode::All);
ValidationResult != CbValidateError::None)
{
- ZEN_ERROR("Manifest validation failed: {}, state will be wiped", ValidationResult);
+ ZEN_ERROR("Manifest validation failed: {}, state will be wiped", uint32_t(ValidationResult));
WipeState = true;
- WipeReason = "Validation of manifest at '{}' failed: {}"_format(ManifestPath, ValidationResult);
+ WipeReason = fmt::format("Validation of manifest at '{}' failed: {}", ManifestPath, uint32_t(ValidationResult));
}
else
{
@@ -615,7 +613,7 @@ ZenServer::InitializeState(const ZenServerOptions& ServerOptions)
if (ManifestVersion != ZEN_CFG_SCHEMA_VERSION)
{
WipeState = true;
- WipeReason = "Manifest schema version: {}, differs from required: {}"_format(ManifestVersion, ZEN_CFG_SCHEMA_VERSION);
+ WipeReason = fmt::format("Manifest schema version: {}, differs from required: {}", ManifestVersion, ZEN_CFG_SCHEMA_VERSION);
}
}
}