Use more ResetAsync/DisposeAsync internally for better async

This commit is contained in:
Wizou 2024-09-07 18:43:52 +02:00
parent 62a691359b
commit 68a1c8650f
2 changed files with 4 additions and 4 deletions

2
.github/dev.yml vendored
View file

@ -1,7 +1,7 @@
pr: none pr: none
trigger: [ master ] trigger: [ master ]
name: 4.1.9-dev.$(Rev:r) name: 4.1.10-dev.$(Rev:r)
pool: pool:
vmImage: ubuntu-latest vmImage: ubuntu-latest

View file

@ -237,7 +237,7 @@ namespace WTelegram
foreach (var altSession in _session.DCSessions.Values) foreach (var altSession in _session.DCSessions.Values)
if (altSession.Client != null && altSession.Client != this) if (altSession.Client != null && altSession.Client != this)
{ {
altSession.Client.Dispose(); await altSession.Client.DisposeAsync();
altSession.Client = null; altSession.Client = null;
} }
} }
@ -735,7 +735,7 @@ namespace WTelegram
retryLast = false; retryLast = false;
else else
{ {
Reset(false, false); await ResetAsync(false, false);
_dcSession.Renew(); _dcSession.Renew();
await ConnectAsync(); await ConnectAsync();
} }
@ -1562,7 +1562,7 @@ namespace WTelegram
Session.DCSession dcSession; Session.DCSession dcSession;
lock (_session) lock (_session)
dcSession = GetOrCreateDCSession(dcId, _dcSession.DataCenter.flags); dcSession = GetOrCreateDCSession(dcId, _dcSession.DataCenter.flags);
Reset(false, false); await ResetAsync(false, false);
_session.MainDC = dcId; _session.MainDC = dcId;
_dcSession.Client = null; _dcSession.Client = null;
_dcSession = dcSession; _dcSession = dcSession;