From cf1c29e9ef2bd223b6fe7d5ee16999d6a2afc702 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 21 Feb 2024 02:11:16 +0100 Subject: [PATCH] Little better fix for #233 --- src/Client.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 6843b76..328396f 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -867,12 +867,12 @@ namespace WTelegram _dcSession.Client = null; // is it address for a known DCSession? _dcSession = _session.DCSessions.Values.FirstOrDefault(dcs => dcs.EndPoint.Equals(endpoint)); - if (_dcSession == null && defaultDc != 0 && _session.DCSessions.TryGetValue(defaultDc, out _dcSession)) - _dcSession.DataCenter = null; + if (defaultDc != 0) _dcSession ??= _session.DCSessions.GetValueOrDefault(defaultDc); _dcSession ??= new() { Id = Helpers.RandomLong() }; _dcSession.Client = this; Helpers.Log(2, $"Connecting to {endpoint}..."); tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); + _dcSession.DataCenter = null; } } }