mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
parent
659becfd51
commit
1877c9061c
|
|
@ -85,6 +85,13 @@ namespace TLSharp.Core
|
||||||
{
|
{
|
||||||
if (dcOptions == null || !dcOptions.Any())
|
if (dcOptions == null || !dcOptions.Any())
|
||||||
throw new InvalidOperationException($"Can't reconnect. Establish initial connection first.");
|
throw new InvalidOperationException($"Can't reconnect. Establish initial connection first.");
|
||||||
|
|
||||||
|
TLExportedAuthorization exported = null;
|
||||||
|
if (_session.TLUser != null)
|
||||||
|
{
|
||||||
|
TLRequestExportAuthorization exportAuthorization = new TLRequestExportAuthorization() { DcId = dcId };
|
||||||
|
exported = await SendRequestAsync<TLExportedAuthorization>(exportAuthorization);
|
||||||
|
}
|
||||||
|
|
||||||
var dc = dcOptions.First(d => d.Id == dcId);
|
var dc = dcOptions.First(d => d.Id == dcId);
|
||||||
|
|
||||||
|
|
@ -92,7 +99,14 @@ namespace TLSharp.Core
|
||||||
_session.ServerAddress = dc.IpAddress;
|
_session.ServerAddress = dc.IpAddress;
|
||||||
_session.Port = dc.Port;
|
_session.Port = dc.Port;
|
||||||
|
|
||||||
await ConnectAsync(true);
|
await ConnectAsync(true);
|
||||||
|
|
||||||
|
if (_session.TLUser != null)
|
||||||
|
{
|
||||||
|
TLRequestImportAuthorization importAuthorization = new TLRequestImportAuthorization() { Id = exported.Id, Bytes = exported.Bytes };
|
||||||
|
var imported = await SendRequestAsync<TLAuthorization>(importAuthorization);
|
||||||
|
OnUserAuthenticated(((TLUser)imported.User));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RequestWithDcMigration(TLMethod request)
|
private async Task RequestWithDcMigration(TLMethod request)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue