Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

add handler for exception with code 32 #910

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions TLSharp.Core/Network/MtProtoSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private Tuple<byte[], ulong, int> DecodeMessage(byte[] body)
return HandleBadServerSalt(messageId, sequence, messageReader, request, token);
case 0xa7eff811: // bad_msg_notification
//logger.debug("MSG bad_msg_notification");
return HandleBadMsgNotification(messageId, sequence, messageReader);
return HandleBadMsgNotification(messageId, sequence, messageReader, request);
case 0x276d3ec6: // msg_detailed_info
//logger.debug("MSG msg_detailed_info");
return HandleMsgDetailedInfo(messageId, sequence, messageReader);
Expand Down Expand Up @@ -374,7 +374,7 @@ private bool HandleMsgDetailedInfo(ulong messageId, int sequence, BinaryReader m
return false;
}

private bool HandleBadMsgNotification(ulong messageId, int sequence, BinaryReader messageReader)
private bool HandleBadMsgNotification(ulong messageId, int sequence, BinaryReader messageReader, TeleSharp.TL.TLMethod request)
{
uint code = messageReader.ReadUInt32();
ulong requestId = messageReader.ReadUInt64();
Expand All @@ -394,7 +394,10 @@ private bool HandleBadMsgNotification(ulong messageId, int sequence, BinaryReade
case 20:
throw new InvalidOperationException("message too old, and it cannot be verified whether the server has received a message with this msg_id or not");
case 32:
throw new InvalidOperationException("msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno)");
session.Sequence += 64;
var t3 = Send(request);
t3.Wait();
break;
case 33:
throw new InvalidOperationException(" msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno)");
case 34:
Expand Down