mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2026-01-03 15:19:57 +01:00
better handle sendSemaphore on client dispose scenario
This commit is contained in:
parent
b6dbf9564f
commit
69f9e0c418
|
|
@ -185,6 +185,7 @@ namespace WTelegram
|
|||
lock (_pendingRpcs) // abort all pending requests
|
||||
foreach (var rpc in _pendingRpcs.Values)
|
||||
rpc.tcs.TrySetException(ex);
|
||||
_sendSemaphore.Dispose();
|
||||
_networkStream = null;
|
||||
if (IsMainDC) _session.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
|
|
@ -1304,7 +1305,7 @@ namespace WTelegram
|
|||
await SendAsync(container, false);
|
||||
return;
|
||||
}
|
||||
await _sendSemaphore.WaitAsync();
|
||||
await _sendSemaphore.WaitAsync(_cts.Token);
|
||||
try
|
||||
{
|
||||
using var memStream = new MemoryStream(1024);
|
||||
|
|
|
|||
Loading…
Reference in a new issue