diff --git a/src/network/network_coordinator.h b/src/network/network_coordinator.h --- 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;