Implemented connection of match server to global lobby

This commit is contained in:
Ivan Savenko committed 2024-01-19 23:52:28 +02:00
1 parent 80e960bc8e
commit 9fb7d2817a
7 files changed
+134 -31

No files matched your search

+5 -8
View File
@@ -37,6 +37,7 @@ VCMI_LIB_NAMESPACE_END
class CGameHandler;
class CBaseForServerApply;
class CBaseForGHApply;
class GlobalLobbyProcessor;
enum class EServerState : ui8
{
@@ -47,15 +48,11 @@ enum class EServerState : ui8
SHUTDOWN
};
class CVCMIServer : public LobbyInfo, public INetworkServerListener, public INetworkClientListener, public INetworkTimerListener
class CVCMIServer : public LobbyInfo, public INetworkServerListener, public INetworkTimerListener
{
std::unique_ptr<INetworkHandler> networkHandler;
/// Network server instance that receives and processes incoming connections on active socket
std::unique_ptr<INetworkServer> networkServer;
/// Outgoing connection established by this server to game lobby for proxy mode (only in lobby game)
std::unique_ptr<INetworkClient> outgoingConnection;
std::unique_ptr<GlobalLobbyProcessor> lobbyProcessor;
std::chrono::steady_clock::time_point gameplayStartTime;
std::chrono::steady_clock::time_point lastTimerUpdateTime;
@@ -64,6 +61,8 @@ public:
/// List of all active connections
std::vector<std::shared_ptr<CConnection>> activeConnections;
std::unique_ptr<INetworkHandler> networkHandler;
private:
bool restartGameplay; // FIXME: this is just a hack
@@ -75,8 +74,6 @@ private:
void onDisconnected(const std::shared_ptr<INetworkConnection> & connection) override;
void onPacketReceived(const std::shared_ptr<INetworkConnection> & connection, const std::vector<uint8_t> & message) override;
void onNewConnection(const std::shared_ptr<INetworkConnection> &) override;
void onConnectionFailed(const std::string & errorMessage) override;
void onConnectionEstablished(const std::shared_ptr<INetworkConnection> &) override;
void onTimer() override;
void establishOutgoingConnection();