优化Steam网络管理,添加主机延迟获取功能,重构房间成员管理逻辑

This commit is contained in:
Ayndpa
2025-11-19 20:56:48 +08:00
parent cd7a035ba8
commit 455539cbf1
5 changed files with 152 additions and 80 deletions

View File

@@ -40,8 +40,9 @@ public:
bool isHost() const { return g_isHost; }
bool isClient() const { return g_isClient; }
bool isConnected() const { return g_isConnected; }
const std::map<HSteamNetConnection, UserInfo>& getUserMap() const { return userMap; }
const std::vector<HSteamNetConnection>& getConnections() const { return connections; }
int getHostPing() const { return hostPing_; }
int getConnectionPing(HSteamNetConnection conn) const;
HSteamNetConnection getConnection() const { return g_hConnection; }
ISteamNetworkingSockets* getInterface() const { return m_pInterface; }
@@ -81,8 +82,8 @@ private:
// Connections
std::vector<HSteamNetConnection> connections;
std::map<HSteamNetConnection, UserInfo> userMap;
std::mutex connectionsMutex;
int hostPing_; // Ping to host (for clients) or average ping (for host)
// Connection config
int g_retryCount;