mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
TL deserialization errors no longer cause a ReactorError. Renewing session on layer change to prevent old layer messages
This commit is contained in:
parent
85cc404213
commit
1a00ae5a77
|
|
@ -50,7 +50,7 @@ namespace WTelegramClientTest
|
|||
await CreateAndConnect();
|
||||
break;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception ex) when (ex is not ObjectDisposedException)
|
||||
{
|
||||
Console.WriteLine("Connection still failing: " + ex.Message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -465,6 +465,8 @@ namespace WTelegram
|
|||
Helpers.Log(1, $"{_dcSession.DcID}>Ignoring 0x{ctorNb:X8} because of wrong timestamp {msgStamp:u} - {utcNow:u} Δ={new TimeSpan(_dcSession.ServerTicksOffset):c}");
|
||||
return null;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (ctorNb == Layer.MsgContainerCtor)
|
||||
{
|
||||
Helpers.Log(1, $"{_dcSession.DcID}>Receiving {"MsgContainer",-40} {msgStamp:u} (svc)");
|
||||
|
|
@ -482,6 +484,12 @@ namespace WTelegram
|
|||
return obj;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Helpers.Log(4, $"While deserializing frame #{ctorNb:x}: " + ex.ToString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static string TransportError(int error_code) => error_code switch
|
||||
{
|
||||
|
|
@ -916,6 +924,7 @@ namespace WTelegram
|
|||
TLConfig = new Config { this_dc = _session.MainDC, dc_options = _session.DcOptions };
|
||||
else
|
||||
{
|
||||
if (_dcSession.Layer != 0 && _dcSession.Layer != Layer.Version) _dcSession.Renew();
|
||||
var initParams = JSONValue.FromJsonElement(System.Text.Json.JsonDocument.Parse(Config("init_params")).RootElement);
|
||||
TLConfig = await this.InvokeWithLayer(Layer.Version,
|
||||
new TL.Methods.InitConnection<Config>
|
||||
|
|
|
|||
Loading…
Reference in a new issue