async def _ensure_connected(self): if self._protocol_client is not None: return # already connected while True: servers = await self._servers_cache.get( str(self.used_server_cell_id)) for server in servers: try: self._websocket = await asyncio.wait_for( websockets.connect(server, ssl=self._ssl_context), 5) self._protocol_client = ProtocolClient( self._websocket, self._friends_cache, self._games_cache, self._translations_cache, self._stats_cache, self._times_cache, self._user_info_cache, self._steam_app_ownership_ticket_cache, self.used_server_cell_id) return except (asyncio.TimeoutError, OSError, websockets.InvalidURI, websockets.InvalidHandshake): continue logger.exception( "Failed to connect to any server, reconnecting in %d seconds...", RECONNECT_INTERVAL_SECONDS) await asyncio.sleep(RECONNECT_INTERVAL_SECONDS)
async def _ensure_connected(self): if self._protocol_client is not None: return # already connected while True: for server in await self._websocket_list.get( self.used_server_cell_id): try: self._websocket = await asyncio.wait_for( websockets.connect(server, ssl=self._ssl_context, max_size=MAX_INCOMING_MESSAGE_SIZE), 5) self._protocol_client = ProtocolClient( self._websocket, self._friends_cache, self._games_cache, self._translations_cache, self._stats_cache, self._times_cache, self._user_info_cache, self._local_machine_cache, self._steam_app_ownership_ticket_cache, self.used_server_cell_id) logger.info( f'Connected to Steam on CM {server} on cell_id {self.used_server_cell_id}' ) return except (asyncio.TimeoutError, OSError, websockets.InvalidURI, websockets.InvalidHandshake): continue logger.exception( "Failed to connect to any server, reconnecting in %d seconds...", RECONNECT_INTERVAL_SECONDS) await asyncio.sleep(RECONNECT_INTERVAL_SECONDS)
async def client(protobuf_client, friends_cache, games_cache, translations_cache, stats_cache, times_cache, user_info_cache, ownership_ticket_cache, used_server_cellid): return ProtocolClient(protobuf_client, friends_cache, games_cache, translations_cache, stats_cache, times_cache, user_info_cache, ownership_ticket_cache, used_server_cellid)
async def client(protobuf_client, friends_cache, games_cache, translations_cache, stats_cache, times_cache, user_info_cache): return ProtocolClient(MagicMock(), friends_cache, games_cache, translations_cache, stats_cache, times_cache, user_info_cache)
async def client(protobuf_client, friends_cache, games_cache): return ProtocolClient(MagicMock(), friends_cache, games_cache)