Merge pull request #69 from EriHoss/stop_getfile_sessions

Make sure started Session is always stopped upon exceptions in Client.get_file
This commit is contained in:
Dan 2018-05-01 11:45:51 +02:00 committed by GitHub
commit 11aa46665e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2988,13 +2988,17 @@ class Client:
)
session.start()
session.send(
functions.auth.ImportAuthorization(
id=exported_auth.id,
bytes=exported_auth.bytes
try:
session.send(
functions.auth.ImportAuthorization(
id=exported_auth.id,
bytes=exported_auth.bytes
)
)
)
except Exception as e:
session.stop()
raise e
else:
session = Session(
dc_id,