sochix / TLSharp

Telegram client library implemented in C#
1k stars 379 forks source link

File session corrupted #932

Open solarin opened 4 years ago

solarin commented 4 years ago

Hello, It happened that after closing the application, restarting the application, the software wasn't able to connect throwing an exception and I had to delete the session file and reauthenticate again.

I didn't see properly how this file is working, so, what can go wrong in this file to make this happen?

is the session storing information regarding the expected bytes to receive from the server?

System.InvalidOperationException: Can't decode packet at TLSharp.Core.Network.MtProtoSender.DecodeMessage(Byte[] body) in source\repos\TLSharp\TLSharp.Core\Network\MtProtoSender.cs:line 115 at TLSharp.Core.Network.MtProtoSender.d8.MoveNext() in source\repos\TLSharp\TLSharp.Core\Network\MtProtoSender.cs:line 141 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() at TLSharp.Core.TelegramClient.d13.MoveNext() in source\repos\TLSharp\TLSharp.Core\TelegramClient.cs:line 107 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at test_console.Program.d__2.MoveNext() in source\repos\test-console\test-console\Program.cs:line 29

knocte commented 4 years ago

If you didn't save a copy of the file, we can only speculate.

solarin commented 4 years ago

the telephone i used was marked as spammer because it tried to reconnect too fast, shit! i need to wait 3 hours.

knocte commented 4 years ago

the telephone i used was marked as spammer because it tried to reconnect too fast, shit! i need to wait 3 hours.

That sounds like a different problem, not related to this issue.

solarin commented 4 years ago

this makes me think that the session file is storing some information about the next expected packet

knocte commented 4 years ago

the telephone i used was marked as spammer because it tried to reconnect too fast, shit! i need to wait 3 hours.

was that telephone emirati? Maybe related to issue 935?

solarin commented 4 years ago

the telephone i used was marked as spammer because it tried to reconnect too fast, shit! i need to wait 3 hours.

was that telephone emirati? Maybe related to issue 935?

no no this is a vietnamese number, the one that was working

solarin commented 4 years ago

this session file problem exists regardless of the number. so let's keep separated from #935

solarin commented 4 years ago

anybody has an idea of which fields in the session object can cause the communication to abort?

if sequence is not updated for example?