Commit graph

7 commits

Author SHA1 Message Date
Andres G. Aragoneses 79ad0fc21e Core: make MtProtoSender.GenerateSequence() thread-safe
Even if you're not supposed to use multiple threads with TLSharp,
it might be worth it to try to make this sequence increment in
a thread-safe way. Race conditions are always bad even if you know
you are not supposed to use something in a certain way...

@Laituex was having a ErrCode=32 'msg_seqno too low' problem and this
is the first thing we looked at (even if he swore that he was not
using different threads to access the telegram network).

(Backported from 881bdd27a5 )

# Conflicts:
#	src/TgSharp.Core/Session.cs
2020-10-14 20:48:43 +02:00
Andres G. Aragoneses ef499c6fef Core: refactor FileSessionStore class
* Move it into its own file.
* Fix typo in var name "Exsist"
* Move Session.ToBytes() and Session.FromBytes() methods to it.
2020-10-13 15:18:41 +02:00
Andres G. Aragoneses ef89274e1f Core: refactor around Session vs SessionStore
This will help implementing session storage in JSON
format. WIP PRs:
- https://github.com/nblockchain/TgSharp/pull/18
- https://github.com/nblockchain/TgSharp/pull/29
2020-10-13 15:02:00 +02:00
Andres Aragoneses cec35c6004 Run tests in CI (Windows OS only for now)
The reason for such a hack when runing in CI is because we
need to make sure we're using higher sequence numbers than
any previous times (and even previous runs of the test suite).

And we run 1 test only for now, later we will enable more.

Other notes:

The trick to extract secrets to files was taken from:
https://stackoverflow.com/a/59482124/544947

The binary-to-text encoding/decoding was taken from:
https://stackoverflow.com/a/42725926/544947

The way to add defines to DefineConstants for MSBuild:
https://stackoverflow.com/a/5053070/544947
2020-09-19 17:00:34 +08:00
Andres G. Aragoneses ff4ba68074 Core: cosmetic, fix whitespace in Session.cs
Some tabs to spaces
2020-09-14 23:51:13 +08:00
Andres G. Aragoneses 94edf1b3eb Rename TeleSharp.TL->TgSharp.TL, fixing TgSharp.Core build (5/5) 2020-09-11 17:15:25 +08:00
Andres G. Aragoneses 932a733197
Finish TLSharp -> TgSharp rename (#1) 2020-04-02 16:37:22 +08:00
Renamed from TLSharp.Core/Session.cs (Browse further)