mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-18 04:20:57 +03:00
Ignore IPv6 setting if there's no matching DC
May close #3075 (assuming this is what was happening). It's better to return some DC rather than crashing.
This commit is contained in:
parent
37b81c6418
commit
3f185aada2
|
@ -692,11 +692,21 @@ class TelegramBaseClient(abc.ABC):
|
||||||
for pk in cls._cdn_config.public_keys:
|
for pk in cls._cdn_config.public_keys:
|
||||||
rsa.add_key(pk.public_key)
|
rsa.add_key(pk.public_key)
|
||||||
|
|
||||||
return next(
|
try:
|
||||||
dc for dc in cls._config.dc_options
|
return next(
|
||||||
if dc.id == dc_id
|
dc for dc in cls._config.dc_options
|
||||||
and bool(dc.ipv6) == self._use_ipv6 and bool(dc.cdn) == cdn
|
if dc.id == dc_id
|
||||||
)
|
and bool(dc.ipv6) == self._use_ipv6 and bool(dc.cdn) == cdn
|
||||||
|
)
|
||||||
|
except StopIteration:
|
||||||
|
self._log[__name__].warning(
|
||||||
|
'Failed to get DC %s (cdn = %s) with use_ipv6 = %s; retrying ignoring IPv6 check',
|
||||||
|
dc_id, cdn, self._use_ipv6
|
||||||
|
)
|
||||||
|
return next(
|
||||||
|
dc for dc in cls._config.dc_options
|
||||||
|
if dc.id == dc_id and bool(dc.cdn) == cdn
|
||||||
|
)
|
||||||
|
|
||||||
async def _create_exported_sender(self: 'TelegramClient', dc_id):
|
async def _create_exported_sender(self: 'TelegramClient', dc_id):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user