mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2026-04-07 23:43:56 +00:00
fix MT issue in session.Save
This commit is contained in:
parent
cb35ec3799
commit
66757ccd0b
1 changed files with 6 additions and 7 deletions
|
|
@ -88,12 +88,12 @@ namespace WTelegram
|
|||
encryptor.TransformFinalBlock(finalBlock, 0, utf8Json.Length & 15).CopyTo(output.AsMemory(48 + utf8Json.Length & ~15));
|
||||
if (!File.Exists(_pathname))
|
||||
File.WriteAllBytes(_pathname, output);
|
||||
else
|
||||
{
|
||||
string tempPathname = _pathname + ".tmp";
|
||||
File.WriteAllBytes(tempPathname, output);
|
||||
File.Replace(tempPathname, _pathname, null);
|
||||
}
|
||||
else lock (this)
|
||||
{
|
||||
string tempPathname = _pathname + ".tmp";
|
||||
File.WriteAllBytes(tempPathname, output);
|
||||
File.Replace(tempPathname, _pathname, null);
|
||||
}
|
||||
}
|
||||
|
||||
internal (long msgId, int seqno) NewMsg(bool isContent)
|
||||
|
|
@ -104,7 +104,6 @@ namespace WTelegram
|
|||
lock (this)
|
||||
{
|
||||
if (msgId <= CurrentDCSession.LastSentMsgId) msgId = CurrentDCSession.LastSentMsgId += 4; else CurrentDCSession.LastSentMsgId = msgId;
|
||||
|
||||
seqno = isContent ? CurrentDCSession.Seqno++ * 2 + 1 : CurrentDCSession.Seqno * 2;
|
||||
Save();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue