mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
Maintain AddressFamily when migrating DCs
This commit is contained in:
parent
f711948da7
commit
f6e14c7499
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
## _a Telegram Client API library written 100% in C# and .NET Standard_
|
||||
|
||||
This ReadMe is a quick but important tutorial to learn the fundamentals about this library. Please read it all.
|
||||
|
||||
# How to use
|
||||
|
||||
>⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this advanced topic before proceeding.
|
||||
|
|
|
|||
|
|
@ -354,7 +354,9 @@ namespace WTelegram
|
|||
{
|
||||
_dcSession.DataCenter = _session.DcOptions.Where(dc => dc.id == TLConfig.this_dc)
|
||||
.OrderByDescending(dc => dc.ip_address == endpoint?.Address.ToString())
|
||||
.ThenByDescending(dc => dc.port == endpoint?.Port).First();
|
||||
.ThenByDescending(dc => dc.port == endpoint?.Port)
|
||||
.ThenByDescending(dc => dc.flags == (endpoint?.AddressFamily == AddressFamily.InterNetworkV6 ? DcOption.Flags.ipv6 : 0))
|
||||
.First();
|
||||
_session.DCSessions[TLConfig.this_dc] = _dcSession;
|
||||
}
|
||||
if (_session.MainDC == 0) _session.MainDC = TLConfig.this_dc;
|
||||
|
|
|
|||
Loading…
Reference in a new issue