From 566791e647c895d1bb6d62226385bab6cdc73268 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Sat, 25 Jan 2025 20:47:12 -0600 Subject: [PATCH 1/2] chore: limit API to only listen on localhost (#1740) --- dChatServer/ChatWebAPI.cpp | 7 ++++--- resources/chatconfig.ini | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dChatServer/ChatWebAPI.cpp b/dChatServer/ChatWebAPI.cpp index 75ff2d64..49903ced 100644 --- a/dChatServer/ChatWebAPI.cpp +++ b/dChatServer/ChatWebAPI.cpp @@ -150,11 +150,12 @@ ChatWebAPI::~ChatWebAPI() { bool ChatWebAPI::Startup() { // Make listen address - std::string listen_ip = Game::config->GetValue("web_server_listen_ip"); - if (listen_ip == "localhost") listen_ip = "127.0.0.1"; + // std::string listen_ip = Game::config->GetValue("web_server_listen_ip"); + // if (listen_ip == "localhost") listen_ip = "127.0.0.1"; const std::string& listen_port = Game::config->GetValue("web_server_listen_port"); - const std::string& listen_address = "http://" + listen_ip + ":" + listen_port; + // const std::string& listen_address = "http://" + listen_ip + ":" + listen_port; + const std::string& listen_address = "http://localhost:" + listen_port; LOG("Starting web server on %s", listen_address.c_str()); // Create HTTP listener diff --git a/resources/chatconfig.ini b/resources/chatconfig.ini index d59d8252..1391df44 100644 --- a/resources/chatconfig.ini +++ b/resources/chatconfig.ini @@ -9,5 +9,6 @@ max_number_of_friends=50 web_server_enabled=0 -web_server_listen_ip=127.0.0.1 +# Unused for now +# web_server_listen_ip=127.0.0.1 web_server_listen_port=2005 From ae37641635488d5940803c50db51f89a5cd8634d Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Sat, 25 Jan 2025 18:47:51 -0800 Subject: [PATCH 2/2] eliminate children (#1741) --- dMasterServer/MasterServer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dMasterServer/MasterServer.cpp b/dMasterServer/MasterServer.cpp index 7b3e8871..72a35f2a 100644 --- a/dMasterServer/MasterServer.cpp +++ b/dMasterServer/MasterServer.cpp @@ -43,6 +43,13 @@ #include "CDZoneTableTable.h" #include "eGameMasterLevel.h" +#ifdef DARKFLAME_PLATFORM_UNIX + +#include +#include + +#endif + namespace Game { Logger* logger = nullptr; dServer* server = nullptr; @@ -455,6 +462,12 @@ int main(int argc, char** argv) { } } +#ifdef DARKFLAME_PLATFORM_UNIX + // kill off dead zombie instances + int status{}; + waitpid(static_cast(-1), &status, WNOHANG); +#endif + t += std::chrono::milliseconds(masterFrameDelta); std::this_thread::sleep_until(t); }