Prevent "recursive" MsgContainer

This commit is contained in:
Wizou 2023-07-06 10:17:29 +02:00
parent 1048af4dcf
commit c631072ae4
4 changed files with 5 additions and 6 deletions

View file

@ -689,7 +689,7 @@ namespace WTelegram
Rpc prevRequest;
lock (_pendingRpcs)
_pendingRpcs.TryGetValue(badMsgNotification.bad_msg_id, out prevRequest);
await SendAsync(lastSentMsg, true, prevRequest);
await SendAsync(lastSentMsg, lastSentMsg is not MsgContainer, prevRequest);
lock (_pendingRpcs)
_pendingRpcs.Remove(badMsgNotification.bad_msg_id);
}

View file

@ -198,12 +198,12 @@ namespace TL
writer.Write(msg.msg_id);
writer.Write(msg.seqno);
var patchPos = writer.BaseStream.Position;
writer.Write(0); // patched below
writer.WriteTLObject(msg.body);
writer.Write(0); // patched below
if ((msg.seqno & 1) != 0)
WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}");
else
WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}");
writer.WriteTLObject(msg.body);
writer.BaseStream.Position = patchPos;
writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field
writer.Seek(0, SeekOrigin.End);