Changeset View
Changeset View
Standalone View
Standalone View
source/network/NetServer.h
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* Set the turn length to a fixed value. | * Set the turn length to a fixed value. | ||||
* TODO: we should replace this with some adapative lag-dependent computation. | * TODO: we should replace this with some adapative lag-dependent computation. | ||||
*/ | */ | ||||
void SetTurnLength(u32 msecs); | void SetTurnLength(u32 msecs); | ||||
bool UseLobbyAuth() const; | bool UseLobbyAuth() const; | ||||
std::string GetClientIPAddress(const std::string& guid); | |||||
std::string GetHostname(const std::string& guid); | |||||
void OnLobbyAuth(const CStr& name, const CStr& token); | void OnLobbyAuth(const CStr& name, const CStr& token); | ||||
void SendHolePunchingMessage(const CStr& ip, u16 port); | void SendHolePunchingMessage(const CStr& ip, u16 port); | ||||
private: | private: | ||||
CNetServerWorker* m_Worker; | CNetServerWorker* m_Worker; | ||||
const bool m_LobbyAuth; | const bool m_LobbyAuth; | ||||
}; | }; | ||||
Show All 27 Lines | public: | ||||
*/ | */ | ||||
void KickPlayer(const CStrW& playerName, const bool ban); | void KickPlayer(const CStrW& playerName, const bool ban); | ||||
/** | /** | ||||
* Send a message to all clients who match one of the given states. | * Send a message to all clients who match one of the given states. | ||||
*/ | */ | ||||
bool Broadcast(const CNetMessage* message, const std::vector<NetServerSessionState>& targetStates); | bool Broadcast(const CNetMessage* message, const std::vector<NetServerSessionState>& targetStates); | ||||
std::string GetClientIPAddress(const std::string& guid); | |||||
std::string GetHostname(const std::string& guid); | |||||
private: | private: | ||||
friend class CNetServer; | friend class CNetServer; | ||||
friend class CNetFileReceiveTask_ServerRejoin; | friend class CNetFileReceiveTask_ServerRejoin; | ||||
CNetServerWorker(bool useLobbyAuth, int autostartPlayers); | CNetServerWorker(bool useLobbyAuth, int autostartPlayers); | ||||
~CNetServerWorker(); | ~CNetServerWorker(); | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | private: | ||||
*/ | */ | ||||
bool CheckGameLoadStatus(CNetServerSession* changedSession); | bool CheckGameLoadStatus(CNetServerSession* changedSession); | ||||
void ConstructPlayerAssignmentMessage(CPlayerAssignmentMessage& message); | void ConstructPlayerAssignmentMessage(CPlayerAssignmentMessage& message); | ||||
void HandleMessageReceive(const CNetMessage* message, CNetServerSession* session); | void HandleMessageReceive(const CNetMessage* message, CNetServerSession* session); | ||||
/** | /** | ||||
* Send a network warning if the connection to a client is being lost or has bad latency. | * Inform clients if the connection to a client is being lost or has bad latency. | ||||
*/ | */ | ||||
void CheckClientConnections(); | void BroadcastClientPerformance(); | ||||
void SendHolePunchingMessage(const CStr& ip, u16 port); | void SendHolePunchingMessage(const CStr& ip, u16 port); | ||||
/** | /** | ||||
* Internal script context for (de)serializing script messages, | * Internal script context for (de)serializing script messages, | ||||
* and for storing game attributes. | * and for storing game attributes. | ||||
* (TODO: we shouldn't bother deserializing (except for debug printing of messages), | * (TODO: we shouldn't bother deserializing (except for debug printing of messages), | ||||
* we should just forward messages blindly and efficiently.) | * we should just forward messages blindly and efficiently.) | ||||
Show All 22 Lines | private: | ||||
NetServerState m_State; | NetServerState m_State; | ||||
CStrW m_ServerName; | CStrW m_ServerName; | ||||
std::vector<u32> m_BannedIPs; | std::vector<u32> m_BannedIPs; | ||||
std::vector<CStrW> m_BannedPlayers; | std::vector<CStrW> m_BannedPlayers; | ||||
/** | /** | ||||
* Caches hostname per GUID of connected players. | |||||
*/ | |||||
//std::vector<std::string, std::string> g_HostNames; | |||||
/** | |||||
* Holds the GUIDs of all currently paused players. | * Holds the GUIDs of all currently paused players. | ||||
*/ | */ | ||||
std::vector<CStr> m_PausingPlayers; | std::vector<CStr> m_PausingPlayers; | ||||
u32 m_NextHostID; | u32 m_NextHostID; | ||||
CNetServerTurnManager* m_ServerTurnManager; | CNetServerTurnManager* m_ServerTurnManager; | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator