From 8989338bacec91900d97cdf783382306f079175d Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Wed, 13 Apr 2016 18:37:24 +0100 Subject: [PATCH] fix steamclient logon race condition --- steam/client/__init__.py | 5 ++--- steam/core/cm.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/steam/client/__init__.py b/steam/client/__init__.py index 775bdcf..47101d3 100644 --- a/steam/client/__init__.py +++ b/steam/client/__init__.py @@ -34,7 +34,6 @@ class SteamClient(CMClient, FeatureBase): self.on(None, self._handle_jobs) self.on("disconnected", self._handle_disconnect) self.on("reconnect", self._handle_disconnect) - self.on(EMsg.ClientLogOnResponse, self._handle_logon) self.on(EMsg.ClientUpdateMachineAuth, self._handle_update_machine_auth) #: indicates logged on status. Listen to ``logged_on`` when change to ``True`` @@ -81,6 +80,8 @@ class SteamClient(CMClient, FeatureBase): self.current_jobid = 0 def _handle_logon(self, msg): + CMClient._handle_logon(self, msg) + result = EResult(msg.body.eresult) if result == EResult.OK: @@ -108,8 +109,6 @@ class SteamClient(CMClient, FeatureBase): code_mismatch = (result == EResult.InvalidLoginAuthCode) self.emit("auth_code_required", is_2fa, code_mismatch) - else: - self.emit("error", result) def _handle_update_machine_auth(self, message): ok = self.store_sentry(self.username, message.body.bytes) diff --git a/steam/core/cm.py b/steam/core/cm.py index f417acb..8ad9cdb 100644 --- a/steam/core/cm.py +++ b/steam/core/cm.py @@ -63,7 +63,7 @@ class CMClient(EventEmitter): self.on(EMsg.ChannelEncryptRequest, self.__handle_encrypt_request), self.on(EMsg.Multi, self.__handle_multi), - self.on(EMsg.ClientLogOnResponse, self.__handle_logon), + self.on(EMsg.ClientLogOnResponse, self._handle_logon), self.on(EMsg.ClientCMList, self.__handle_cm_list), def emit(self, event, *args): @@ -323,7 +323,7 @@ class CMClient(EventEmitter): gevent.sleep(interval) self.send(message) - def __handle_logon(self, msg): + def _handle_logon(self, msg): result = msg.body.eresult if result in (EResult.TryAnotherCM,