From 4022a7c133da27f1021f60cfae4ba4dab84ea5f3 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Tue, 10 Nov 2026 12:54:57 -0600 Subject: [PATCH] fix: the chat server listens with the password the servers share Only world servers connect to the chat server. It now starts as an internal server, the same way the master server does, and the world servers connect to it with the password they already use for the master server. Co-Authored-By: Claude Fable 5.2 --- dChatServer/ChatServer.cpp | 3 ++- dWorldServer/WorldServer.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dChatServer/ChatServer.cpp b/dChatServer/ChatServer.cpp index 98b7c150b..64269705b 100644 --- a/dChatServer/ChatServer.cpp +++ b/dChatServer/ChatServer.cpp @@ -130,7 +130,8 @@ int main(int argc, char** argv) { const auto externalIPString = Game::config->GetValue("external_ip"); if (!externalIPString.empty()) ourIP = externalIPString; - Game::server = new dServer(ourIP, ourPort, 0, maxClients, false, true, Game::logger, masterIP, masterPort, ServiceType::CHAT, Game::config, &Game::lastSignal, masterPassword); + // Only other servers connect to chat, so it listens with the password the servers share + Game::server = new dServer(ourIP, ourPort, 0, maxClients, true /* Is internal */, true /* Use encryption */, Game::logger, masterIP, masterPort, ServiceType::CHAT, Game::config, &Game::lastSignal, masterPassword); const bool dontGenerateDCF = GeneralUtils::TryParse(Game::config->GetValue("dont_generate_dcf")).value_or(false); Game::chatFilter = new dChatFilter(Game::assetManager->GetResPath().string() + "/chatplus_en_us", dontGenerateDCF); diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index 9d777336f..615b7c414 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -377,7 +377,7 @@ int main(int argc, char** argv) { auto chatSock = SocketDescriptor(static_cast(ourPort + 2), NULL); Game::chatServer = RakNetworkFactory::GetRakPeerInterface(); Game::chatServer->Startup(1, 30, &chatSock, 1); - Game::chatServer->Connect(masterIP.c_str(), chatPort, NET_PASSWORD_EXTERNAL, strnlen(NET_PASSWORD_EXTERNAL, sizeof(NET_PASSWORD_EXTERNAL))); + Game::chatServer->Connect(masterIP.c_str(), chatPort, masterPassword.c_str(), masterPassword.size()); g_ChatIP = masterIP; g_ChatPort = chatPort; @@ -537,7 +537,7 @@ int main(int argc, char** argv) { if (framesSinceChatDisconnect >= chatReconnectionTime) { framesSinceChatDisconnect = 0; - Game::chatServer->Connect(masterIP.c_str(), chatPort, NET_PASSWORD_EXTERNAL, strnlen(NET_PASSWORD_EXTERNAL, sizeof(NET_PASSWORD_EXTERNAL))); + Game::chatServer->Connect(masterIP.c_str(), chatPort, masterPassword.c_str(), masterPassword.size()); } } else framesSinceChatDisconnect = 0;