From 08b9469e2c71e06fdd70d607f281686746755073 Mon Sep 17 00:00:00 2001 From: Satya Ortiz-Gagne Date: Mon, 10 Jun 2019 10:20:39 -0400 Subject: DAIDE - Added connection_handler and server - Ability to open and close port when DAIDE games are started and stopped - Can get the DAIDE port using a request --- diplomacy/client/connection.py | 8 ++++++++ diplomacy/client/response_managers.py | 1 + 2 files changed, 9 insertions(+) (limited to 'diplomacy/client') diff --git a/diplomacy/client/connection.py b/diplomacy/client/connection.py index f9eb628..b2e6cbc 100644 --- a/diplomacy/client/connection.py +++ b/diplomacy/client/connection.py @@ -437,6 +437,14 @@ class Connection(): self._on_socket_message(msg) # Public methods. + @gen.coroutine + def get_daide_port(self, game_id): + """ Send a GetDaidePort request. + :param game_id: game id + :return: int. the game DAIDE port + """ + request = requests.GetDaidePort(game_id=game_id) + return (yield self.send(request)) @gen.coroutine def authenticate(self, username, password, create_user=False): diff --git a/diplomacy/client/response_managers.py b/diplomacy/client/response_managers.py index 5183ac4..991586f 100644 --- a/diplomacy/client/response_managers.py +++ b/diplomacy/client/response_managers.py @@ -298,6 +298,7 @@ MAPPING = { requests.DeleteGame: on_delete_game, requests.GetAllPossibleOrders: default_manager, requests.GetAvailableMaps: default_manager, + requests.GetDaidePort: default_manager, requests.GetDummyWaitingPowers: default_manager, requests.GetPlayablePowers: default_manager, requests.GetPhaseHistory: on_get_phase_history, -- cgit v1.2.3