From 919af929a638110d505e2bd9976c5c42e5729663 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sat, 2 Nov 2019 12:08:34 +0200 Subject: [PATCH] Add bad CM handling to logon (#773) --- SteamKit2/SteamKit2/Steam/CMClient.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SteamKit2/SteamKit2/Steam/CMClient.cs b/SteamKit2/SteamKit2/Steam/CMClient.cs index 29459cdf6..27babe569 100644 --- a/SteamKit2/SteamKit2/Steam/CMClient.cs +++ b/SteamKit2/SteamKit2/Steam/CMClient.cs @@ -520,8 +520,9 @@ void HandleLogOnResponse( IPacketMsg packetMsg ) } var logonResp = new ClientMsgProtobuf( packetMsg ); + var logonResult = ( EResult )logonResp.Body.eresult; - if ( logonResp.Body.eresult == ( int )EResult.OK ) + if ( logonResult == EResult.OK ) { SessionID = logonResp.ProtoHeader.client_sessionid; SteamID = logonResp.ProtoHeader.steamid; @@ -537,6 +538,10 @@ void HandleLogOnResponse( IPacketMsg packetMsg ) heartBeatFunc.Delay = TimeSpan.FromSeconds( hbDelay ); heartBeatFunc.Start(); } + else if ( logonResult == EResult.TryAnotherCM || logonResult == EResult.ServiceUnavailable ) + { + Servers.TryMark( connection.CurrentEndPoint, connection.ProtocolTypes, ServerQuality.Bad ); + } } void HandleLoggedOff( IPacketMsg packetMsg ) {