From aa93d76223f0411b54f5150adbe2c83c33fd61af Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 3 Jul 2021 11:12:28 +0200 Subject: Add: use Game Coordinator to get latest public server listing --- src/network/network_coordinator.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/network/network_coordinator.h') diff --git a/src/network/network_coordinator.h b/src/network/network_coordinator.h index 1dbce063b..7399ce1fc 100644 --- a/src/network/network_coordinator.h +++ b/src/network/network_coordinator.h @@ -21,6 +21,10 @@ * - Game Coordinator probes server to check if it can directly connect. * - Game Coordinator sends GC_REGISTER_ACK with type of connection. * - Server sends every 30 seconds SERVER_UPDATE. + * + * For clients (listing): + * - Client sends CLIENT_LISTING. + * - Game Coordinator returns the full list of public servers via GC_LISTING (multiple packets). */ /** Class for handling the client side of the Game Coordinator connection. */ @@ -31,8 +35,13 @@ private: protected: bool Receive_GC_ERROR(Packet *p) override; bool Receive_GC_REGISTER_ACK(Packet *p) override; + bool Receive_GC_LISTING(Packet *p) override; public: + /** The idle timeout; when to close the connection because it's idle. */ + static constexpr std::chrono::seconds IDLE_TIMEOUT = std::chrono::seconds(60); + + std::chrono::steady_clock::time_point last_activity; ///< The last time there was network activity. bool connecting; ///< Are we connecting to the Game Coordinator? ClientNetworkCoordinatorSocketHandler() : connecting(false) {} @@ -44,6 +53,7 @@ public: void Register(); void SendServerUpdate(); + void GetListing(); }; extern ClientNetworkCoordinatorSocketHandler _network_coordinator_client; -- cgit v1.2.3-54-g00ecf