File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,6 +58,12 @@ find_package(ZLIB REQUIRED)
5858# Find OpenSSL for encryption
5959find_package (OpenSSL REQUIRED )
6060
61+ # Find UUID library
62+ find_library (UUID_LIBRARY NAMES uuid )
63+ if (NOT UUID_LIBRARY)
64+ message (FATAL_ERROR "libuuid not found - install libuuid-dev or equivalent" )
65+ endif ()
66+
6167# Add GLM include directory
6268include_directories (${glm_INCLUDE_DIRS} )
6369
@@ -101,6 +107,7 @@ set(LOGIC_CORE_SOURCES
101107 src/game/GameLogic.cpp
102108 src/game/EntityManager.cpp
103109 src/game/Player.cpp
110+ src/game/PlayerManager.cpp
104111 src/game/NPCEntity.cpp
105112)
106113
@@ -173,6 +180,7 @@ target_link_libraries(gameserver PRIVATE
173180 Python3::Python
174181 fmt::fmt
175182 spdlog::spdlog
183+ ${UUID_LIBRARY}
176184)
177185
178186# Compiler flags
Original file line number Diff line number Diff line change 2222#include < sys/prctl.h>
2323#include < sys/socket.h>
2424
25+ #include " logging/Logger.hpp"
26+
2527class ProcessPool {
2628public:
2729 enum class ProcessRole {
@@ -45,7 +47,7 @@ class ProcessPool {
4547 pid_t GetMasterPid () const { return masterPid_; }
4648
4749 // Callback for worker process
48- void SetWorkerMain (std::function<void (int workerId)> workerMain );
50+ void SetWorkerMain (std::function<void (int workerId)> workerMainFunc );
4951
5052 // Inter-process communication with message length prefix
5153 bool SendToWorker (int workerId, const std::string& message);
@@ -84,7 +86,7 @@ class ProcessPool {
8486 std::atomic<bool > shutdownRequested_{false };
8587
8688 std::vector<pid_t > workerPids_;
87- std::function<void (int workerId)> workerMain_ ;
89+ std::function<void (int workerId)> workerMainFunc_ ;
8890
8991 // IPC mechanisms
9092 std::vector<int > workerPipes_; // [read_fd, write_fd] for each worker
Original file line number Diff line number Diff line change 11#include " process/ProcessPool.hpp"
2- #include " logging/Logger.hpp"
32
43ProcessPool::ProcessPool (int numProcesses)
54 : numProcesses_(numProcesses > 0 ? numProcesses : 1 ) {
@@ -90,8 +89,8 @@ void ProcessPool::MasterProcess() {
9089
9190 Logger::Info (" Worker process {} started (PID: {})" , i, getpid ());
9291
93- if (workerMain_ ) {
94- workerMain_ (i);
92+ if (workerMainFunc_ ) {
93+ workerMainFunc_ (i);
9594 }
9695
9796 // Cleanup before exit
@@ -167,8 +166,8 @@ void ProcessPool::WorkerProcess(int workerId) {
167166 });
168167 signal (SIGINT, SIG_IGN);
169168
170- if (workerMain_ ) {
171- workerMain_ (workerId);
169+ if (workerMainFunc_ ) {
170+ workerMainFunc_ (workerId);
172171 }
173172}
174173
@@ -219,8 +218,8 @@ void ProcessPool::RestartWorker(int workerId) {
219218
220219 Logger::Info (" Restarted worker {} (PID: {})" , workerId, getpid ());
221220
222- if (workerMain_ ) {
223- workerMain_ (workerId);
221+ if (workerMainFunc_ ) {
222+ workerMainFunc_ (workerId);
224223 }
225224
226225 close (workerPipes_[workerId * 2 ]);
@@ -512,3 +511,7 @@ void ProcessPool::SetupSignalHandlers() {
512511 signal (SIGCHLD, SIG_IGN); // We'll handle child processes with waitpid
513512 signal (SIGPIPE, SIG_IGN); // Ignore broken pipes
514513}
514+
515+ void ProcessPool::SetWorkerMain (std::function<void (int )> workerMainFunc) {
516+ workerMainFunc_ = std::move (workerMainFunc);
517+ }
You can’t perform that action at this time.
0 commit comments