mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Abort pending requests on Dispose
(I thought it was already the case!?)
This commit is contained in:
parent
807ee0cc9a
commit
5febd2d27b
|
|
@ -174,6 +174,10 @@ namespace WTelegram
|
|||
{
|
||||
Helpers.Log(2, $"{_dcSession.DcID}>Disposing the client");
|
||||
Reset(false, IsMainDC);
|
||||
var ex = new TaskCanceledException("WTelegram.Client was disposed");
|
||||
lock (_pendingRpcs) // abort all pending requests
|
||||
foreach (var rpc in _pendingRpcs.Values)
|
||||
rpc.tcs.TrySetException(ex);
|
||||
_networkStream = null;
|
||||
if (IsMainDC) _session.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
|
|
|
|||
Loading…
Reference in a new issue