Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Fix issue with leaving session in a invalid state if GetFile throws an exception after reconnecting to another DC #548

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MichaelManley
Copy link

In TelegramClient.GetFile, if the file is in another DC, it reconnects to the DC to be able to get the file. In an exception is thrown after that whilst trying to download the file it doesn't reconnect to the original DC which leaves the session in an invalid state.

This wraps the calls after the ReconnectToDCAs in a try finally to ensure that whatever happens we always try to do the reconnect to the original DC.

…econnect to original DC even if there is an exception
@knocte
Copy link
Collaborator

knocte commented Aug 12, 2017

@sochix can you review?

Copy link

@andreysolovyov andreysolovyov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried to apply this fix, but get same result. After first uncatched exception session corrupted and every request ends with "can't read packet" exception. Do we need to make some migration calls after restoring session in final section?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants