diff --git a/FAQ.md b/FAQ.md index 6e58d2f..c6d398d 100644 --- a/FAQ.md +++ b/FAQ.md @@ -59,7 +59,7 @@ You also need to obtain their `access_hash` which is specific to the resource yo This serves as a proof that the logged-in user is entitled to access that channel/user/photo/document/... (otherwise, anybody with the ID could access it) -> A small private `Chat` don't need an access_hash and can be queried using their `chat_id` only. +> A small private group `Chat` don't need an access_hash and can be queried using their `chat_id` only. However most common chat groups are not `Chat` but a `Channel` supergroup (without the `broadcast` flag). See [Terminology in ReadMe](README.md#terminology). Some TL methods only applies to private `Chat`, some only applies to `Channel` and some to both. diff --git a/src/Client.cs b/src/Client.cs index 763c977..89589af 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -181,7 +181,7 @@ namespace WTelegram { Helpers.Log(2, $"{_dcSession.DcID}>Disposing the client"); Reset(false, IsMainDC); - var ex = new TaskCanceledException("WTelegram.Client was disposed"); + var ex = new ObjectDisposedException("WTelegram.Client was disposed"); lock (_pendingRpcs) // abort all pending requests foreach (var rpc in _pendingRpcs.Values) rpc.tcs.TrySetException(ex); @@ -349,7 +349,7 @@ namespace WTelegram lock (_pendingRpcs) // retry all pending requests { foreach (var rpc in _pendingRpcs.Values) - rpc.tcs.SetResult(reactorError); // this leads to a retry (see Invoke method) + rpc.tcs.TrySetResult(reactorError); // this leads to a retry (see Invoke method) _pendingRpcs.Clear(); _bareRpc = null; } @@ -359,7 +359,7 @@ namespace WTelegram RaiseUpdates(updatesState); } } - catch + catch (Exception e) when (e is not ObjectDisposedException) { if (IsMainDC) RaiseUpdates(reactorError); @@ -947,7 +947,8 @@ namespace WTelegram } finally { - lock (_session) _session.Save(); + if (_reactorTask != null) // client not disposed + lock (_session) _session.Save(); } Helpers.Log(2, $"Connected to {(TLConfig.test_mode ? "Test DC" : "DC")} {TLConfig.this_dc}... {TLConfig.flags & (Config.Flags)~0x18E00U}"); } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 50f849e..cde7178 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,7 +13,10 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 181 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 181 + +Release Notes: +$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT https://wiz0u.github.io/WTelegramClient @@ -48,7 +51,7 @@ - +