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.start()
try:
session.send( session.send(
functions.auth.ImportAuthorization( functions.auth.ImportAuthorization(
id=exported_auth.id, id=exported_auth.id,
bytes=exported_auth.bytes bytes=exported_auth.bytes
)
) )
) except Exception as e:
session.stop()
raise e
else: else:
session = Session( session = Session(
dc_id, dc_id,