mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
If we've reconnected to another DC during GetFile, ensure we always reconnect to original DC even if there is an exception
This commit is contained in:
parent
133b9fdf6c
commit
4146459be2
|
|
@ -329,20 +329,24 @@ namespace TLSharp.Core
|
|||
var serverPort = _session.Port;
|
||||
|
||||
await ReconnectToDcAsync(ex.DC);
|
||||
var auth = await SendRequestAsync<TLAuthorization>(new TLRequestImportAuthorization
|
||||
{
|
||||
bytes = exportedAuth.bytes,
|
||||
id = exportedAuth.id
|
||||
});
|
||||
result = await GetFile(location, filePartSize, offset);
|
||||
|
||||
_session.AuthKey = authKey;
|
||||
_session.TimeOffset = timeOffset;
|
||||
_transport = new TcpTransport(serverAddress, serverPort);
|
||||
_session.ServerAddress = serverAddress;
|
||||
_session.Port = serverPort;
|
||||
await ConnectAsync();
|
||||
|
||||
try
|
||||
{
|
||||
var auth = await SendRequestAsync<TLAuthorization>(new TLRequestImportAuthorization
|
||||
{
|
||||
bytes = exportedAuth.bytes,
|
||||
id = exportedAuth.id
|
||||
});
|
||||
result = await GetFile(location, filePartSize, offset);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_session.AuthKey = authKey;
|
||||
_session.TimeOffset = timeOffset;
|
||||
_transport = new TcpTransport(serverAddress, serverPort);
|
||||
_session.ServerAddress = serverAddress;
|
||||
_session.Port = serverPort;
|
||||
await ConnectAsync();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Reference in a new issue