From a28b9843956214da425af5a78290ed643f018c0c Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Sat, 10 Aug 2024 23:29:08 +0200
Subject: [PATCH] Fix infinite recursion on Dispose after downloads (fix #274)
---
.github/dev.yml | 2 +-
src/Client.cs | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/.github/dev.yml b/.github/dev.yml
index 7893558..567ecd3 100644
--- a/.github/dev.yml
+++ b/.github/dev.yml
@@ -1,7 +1,7 @@
pr: none
trigger: [ master ]
-name: 4.1.6-dev.$(Rev:r)
+name: 4.1.7-dev.$(Rev:r)
pool:
vmImage: ubuntu-latest
diff --git a/src/Client.cs b/src/Client.cs
index 5efd138..5bb497f 100644
--- a/src/Client.cs
+++ b/src/Client.cs
@@ -49,7 +49,8 @@ namespace WTelegram
/// Size of chunks when uploading/downloading files. Reduce this if you don't have much memory
public int FilePartSize { get; set; } = 512 * 1024;
/// Is this Client instance the main or a secondary DC session
- public bool IsMainDC => (_dcSession?.DataCenter?.id - _session.MainDC) is null or 0;
+ public bool IsMainDC => _dcSession?.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) != true
+ && (_dcSession?.DataCenter?.id - _session.MainDC) is null or 0;
/// Has this Client established connection been disconnected?
public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false);
/// ID of the current logged-in user or 0