mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-10 16:12:22 +03:00
Fix CDN client not being disconnected
This commit is contained in:
parent
8afcd0b91f
commit
06b2d5d786
|
@ -467,11 +467,10 @@ class TelegramBareClient:
|
||||||
|
|
||||||
# The used client will change if FileMigrateError occurs
|
# The used client will change if FileMigrateError occurs
|
||||||
client = self
|
client = self
|
||||||
|
cdn_decrypter = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
offset_index = 0
|
offset_index = 0
|
||||||
cdn_decrypter = None
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
offset = offset_index * part_size
|
offset = offset_index * part_size
|
||||||
|
|
||||||
|
@ -509,6 +508,9 @@ class TelegramBareClient:
|
||||||
if progress_callback:
|
if progress_callback:
|
||||||
progress_callback(f.tell(), file_size)
|
progress_callback(f.tell(), file_size)
|
||||||
finally:
|
finally:
|
||||||
|
if cdn_decrypter:
|
||||||
|
try: cdn_decrypter.client.disconnect()
|
||||||
|
except: pass
|
||||||
if isinstance(file, str):
|
if isinstance(file, str):
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user