Commit graph

13 commits

Author SHA1 Message Date
Andres G. Aragoneses 881bdd27a5 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)
2020-09-21 14:52:07 +08:00
Andres G. Aragoneses 90f9305dd6 style: more consistent naming removing underscores
There were less places with underscores in field names than
places without them, so we now are consistent with the most
abundant occurrence.
2020-01-31 14:39:19 +08:00
CheshireCaat 79cf25d257 Reformat MTProto.Serializers
Fix naming for string serializer
Fix naming for bytes serializer
Remove unused method - VectorToString
2020-01-26 02:12:43 +03:00
Andres G. Aragoneses e4d0e97571 Add ability to set directory to store sessions
Now user can set directory to store sessions somewhere else
other than the folder where the program's executable is.

(Based on patch from Felony <onyfel@gmail.com> contributed
in https://github.com/sochix/TLSharp/pull/874 )
2019-10-05 12:41:50 +08:00
Andres G. Aragoneses 60a3c62357 Core: avoid possible infinite loop if switching to same DC
People are reporting that under some circumstances, an infinite
loop could happen when TLSharp tries to handle a reconnection to
a different DC, if the DC instructed to be used is the same as
the one that was used in the last connection.

Not sure how could this happen (although the analysis present in
this github issue [1] might help understand it), but this commit
helps to make TLSharp fail fast (with an exception) instead of an
infinite loop from now on, which will help avoiding people file
issues such as [2] and [3] and instead maybe file a proper bug
report easier to understand, to try to fix the underlying root
cause.

[1] https://github.com/sochix/TLSharp/issues/719
[2] https://github.com/sochix/TLSharp/issues/803
[3] https://github.com/sochix/TLSharp/issues/839
2019-02-10 13:53:46 +01:00
PROger4ever 7cbc40a090 Make Session constructor public for custom ISessionStore implementations
Load() method in ISessionStore requires public constructor of class Session in some cases.
E.g., loading session from a db or a key-value store, manual loading from text-file, JSON/XML and so on.
2017-12-17 21:04:11 +05:00
Ilya P 40c1725e41 - Layer 53
- Fix bug in generator
- Fix DC switching
- change default server
2016-10-15 13:35:54 +03:00
Afshin Arani 6af7c66a81 Redesign Everything 2016-09-24 17:08:26 +03:30
Afshin Arani 1c2e354967 Update Everything 2016-09-22 17:01:59 +03:30
steavy29 f98540bd7f Changed session store to return null when couldn't load instead of exception. 2016-09-06 18:20:06 +03:00
ahmadali shafiee 504b63a6d7 formatting code (ctrl + k + d) 2016-04-18 15:20:57 +04:30
Ilya Pirozhneko 824ba77e12 Added auto dc switching 2016-01-27 14:02:18 +03:00
Ilya Pirozhneko 3bb487a194 TLSharp and Tests 2015-09-28 10:01:17 +08:00