Problem with reconnection via session files
When using session file, Client::connect falls into an infinite loop, causing it to never complete. After some searching, I found out that the issue is with mtp::Encryped and the connect_with_auth function. If I add .time_offset(offset_from_initial_auth) before finish, everything works fine. Without it, the step function keeps getting Read(100) and Write(180), which is deseialized into a BadMsgNotification with error_code: 17. That is, the time_offset is corrected to the correct one, but for some reason nothing changes.
Thanks for investigating. Would you mind submitting a PR?
Thanks for investigating. Would you mind submitting a PR?
I'd like to, but from what I've seen, the struct for the data centers in the session file is automatically generated, which prevents editing it directly and adding a time_offset property that could already be passed to connect_with_auth.
It is possible to extend the session format (most recent change), however I'd actually be more interested in knowing why we don't continue after fixing the offset, because even if we save it, the clock may drift again.
the
stepfunction keeps gettingRead(100)andWrite(180)
Do you mean it's looping indefinitely, or does it get stuck?
It is possible to extend the session format (most recent change), however I'd actually be more interested in knowing why we don't continue after fixing the offset, because even if we save it, the clock may drift again.
the
stepfunction keeps gettingRead(100)andWrite(180)Do you mean it's looping indefinitely, or does it get stuck?
I'm not sure if it is stuck or looping indefinitely (I don't see the difference between the two). Logging in with an empty session file succeeds, logging in with a filled one results in constantly getting BadMsgNotification { status_code: 17, ... } from the server in response to InvokeWithLayer. In this case, the time_offset is corrected to the correct one after each response from the server, but nothing changes. However, adding time_offset after mtp::Encrypted::build() in connect_with_auth somehow fixes this. That's all I know 😔
if it is stuck or looping indefinitely (I don't see the difference between the two)
By looping I mean constantly sending a message and reading bad message. But if it only prints it once, then it's probably stuck and not spamming the request.
if it is stuck or looping indefinitely (I don't see the difference between the two)
By looping I mean constantly sending a message and reading bad message. But if it only prints it once, then it's probably stuck and not spamming the request.
Oh, well, then I could say it's a looping indefinitely.