mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 21:10:29 +00:00
Fix CDN client not being disconnected
This commit is contained in:
@@ -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()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user