Changeset View
Changeset View
Standalone View
Standalone View
source/network/NetServer.h
Show All 15 Lines | |||||
*/ | */ | ||||
#ifndef NETSERVER_H | #ifndef NETSERVER_H | ||||
#define NETSERVER_H | #define NETSERVER_H | ||||
#include "NetFileTransfer.h" | #include "NetFileTransfer.h" | ||||
#include "NetHost.h" | #include "NetHost.h" | ||||
#include "lib/config2.h" | #include "lib/config2.h" | ||||
#include "lib/posix/posix_pthread.h" | |||||
#include "lib/types.h" | #include "lib/types.h" | ||||
#include "scriptinterface/ScriptTypes.h" | #include "scriptinterface/ScriptTypes.h" | ||||
#include <mutex> | #include <mutex> | ||||
#include <string> | #include <string> | ||||
#include <utility> | #include <utility> | ||||
#include <vector> | #include <vector> | ||||
#include <thread> | |||||
class CNetServerSession; | class CNetServerSession; | ||||
class CNetServerTurnManager; | class CNetServerTurnManager; | ||||
class CFsmEvent; | class CFsmEvent; | ||||
class ScriptInterface; | class ScriptInterface; | ||||
class CPlayerAssignmentMessage; | class CPlayerAssignmentMessage; | ||||
class CNetStatsTable; | class CNetStatsTable; | ||||
class CSimulationMessage; | class CSimulationMessage; | ||||
▲ Show 20 Lines • Show All 315 Lines • ▼ Show 20 Lines | |||||
private: | private: | ||||
// Thread-related stuff: | // Thread-related stuff: | ||||
#if CONFIG2_MINIUPNPC | #if CONFIG2_MINIUPNPC | ||||
/** | /** | ||||
* Try to find a UPnP root on the network and setup port forwarding. | * Try to find a UPnP root on the network and setup port forwarding. | ||||
*/ | */ | ||||
static void* SetupUPnP(void*); | static void SetupUPnP(); | ||||
pthread_t m_UPnPThread; | std::thread m_UPnPThread; | ||||
#endif | #endif | ||||
static void* RunThread(void* data); | static void RunThread(CNetServerWorker* data); | ||||
void Run(); | void Run(); | ||||
bool RunStep(); | bool RunStep(); | ||||
pthread_t m_WorkerThread; | std::thread m_WorkerThread; | ||||
std::mutex m_WorkerMutex; | std::mutex m_WorkerMutex; | ||||
// protected by m_WorkerMutex | // protected by m_WorkerMutex | ||||
bool m_Shutdown; | bool m_Shutdown; | ||||
// Queues for messages sent by the game thread (protected by m_WorkerMutex): | // Queues for messages sent by the game thread (protected by m_WorkerMutex): | ||||
std::vector<bool> m_StartGameQueue; | std::vector<bool> m_StartGameQueue; | ||||
std::vector<std::string> m_GameAttributesQueue; | std::vector<std::string> m_GameAttributesQueue; | ||||
std::vector<std::pair<CStr, CStr>> m_LobbyAuthQueue; | std::vector<std::pair<CStr, CStr>> m_LobbyAuthQueue; | ||||
std::vector<u32> m_TurnLengthQueue; | std::vector<u32> m_TurnLengthQueue; | ||||
}; | }; | ||||
/// Global network server for the standard game | /// Global network server for the standard game | ||||
extern CNetServer *g_NetServer; | extern CNetServer *g_NetServer; | ||||
#endif // NETSERVER_H | #endif // NETSERVER_H |
Wildfire Games · Phabricator