From cf7b5223b274beef3ea4d095e669684d704de10f Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Tue, 26 Apr 2016 16:45:08 +0100 Subject: [PATCH] give 5s for logon handler to call disconnect; #22 --- steam/core/cm.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/steam/core/cm.py b/steam/core/cm.py index a58a19d..a4b650b 100644 --- a/steam/core/cm.py +++ b/steam/core/cm.py @@ -36,6 +36,7 @@ class CMClient(EventEmitter): servers = None #: a instance of :class:`steam.core.cm.CMServerList` current_server_addr = None #: (ip, port) tuple + _seen_logon = False _connecting = False connected = False #: :class:`True` if connected to CM channel_secured = False #: :class:`True` once secure channel handshake is complete @@ -157,6 +158,7 @@ class CMClient(EventEmitter): 'steam_id', 'session_id', 'webapi_authenticate_user_nonce', + '_seen_logon', '_recv_loop', '_heartbeat_loop', ]: @@ -210,6 +212,10 @@ class CMClient(EventEmitter): gevent.spawn(self._parse_message, message) gevent.idle() + if not self._seen_logon and self.channel_secured: + if self.wait_event('disconnected', timeout=5) is not None: + return + gevent.spawn(self.disconnect) def _parse_message(self, message): @@ -331,6 +337,7 @@ class CMClient(EventEmitter): self.servers.mark_bad(self.current_server_addr) self.disconnect(True) elif result == EResult.OK: + self._seen_logon = True self._reconnect_backoff_c = 0 self._LOG.debug("Logon completed")