File diff r25848:1aa50567d7ba → r25849:38205b3e59c6
src/network/network_coordinator.h
Show inline comments
 
@@ -12,6 +12,7 @@
 

	
 
#include "core/tcp_coordinator.h"
 
#include "network_stun.h"
 
#include "network_turn.h"
 
#include <map>
 

	
 
/**
 
@@ -42,6 +43,10 @@
 
 *        - a) Server/client connect, client sends CLIENT_CONNECTED to Game Coordinator.
 
 *        - b) Server/client connect fails, both send SERCLI_CONNECT_FAILED to Game Coordinator.
 
 *        - Game Coordinator tries other combination if available.
 
 *    3) TURN?
 
 *        - Game Coordinator sends GC_TURN_CONNECT to server/client.
 
 *        - a) Server/client connect, client sends CLIENT_CONNECTED to Game Coordinator.
 
 *        - b) Server/client connect fails, both send SERCLI_CONNECT_FAILED to Game Coordinator.
 
 *  - If all fails, Game Coordinator sends GC_CONNECT_FAILED to indicate no connection is possible.
 
 */
 

	
 
@@ -52,6 +57,7 @@ private:
 
	std::map<std::string, TCPServerConnecter *> connecter; ///< Based on tokens, the current connecters that are pending.
 
	std::map<std::string, TCPServerConnecter *> connecter_pre; ///< Based on invite codes, the current connecters that are pending.
 
	std::map<std::string, std::map<int, std::unique_ptr<ClientNetworkStunSocketHandler>>> stun_handlers; ///< All pending STUN handlers, stored by token:family.
 
	std::map<std::string, std::unique_ptr<ClientNetworkTurnSocketHandler>> turn_handlers; ///< Pending TURN handler (if any), stored by token.
 
	TCPConnecter *game_connecter = nullptr; ///< Pending connecter to the game server.
 

	
 
	uint32 newgrf_lookup_table_cursor = 0; ///< Last received cursor for the #GameInfoNewGRFLookupTable updates.
 
@@ -67,6 +73,7 @@ protected:
 
	bool Receive_GC_STUN_REQUEST(Packet *p) override;
 
	bool Receive_GC_STUN_CONNECT(Packet *p) override;
 
	bool Receive_GC_NEWGRF_LOOKUP(Packet *p) override;
 
	bool Receive_GC_TURN_CONNECT(Packet *p) override;
 

	
 
public:
 
	/** The idle timeout; when to close the connection because it's idle. */
 
@@ -88,12 +95,14 @@ public:
 
	void CloseToken(const std::string &token);
 
	void CloseAllConnections();
 
	void CloseStunHandler(const std::string &token, uint8 family = AF_UNSPEC);
 
	void CloseTurnHandler(const std::string &token);
 

	
 
	void Register();
 
	void SendServerUpdate();
 
	void GetListing();
 

	
 
	void ConnectToServer(const std::string &invite_code, TCPServerConnecter *connecter);
 
	void StartTurnConnection(std::string &token);
 
};
 

	
 
extern ClientNetworkCoordinatorSocketHandler _network_coordinator_client;