add handler for exception with code 32

This commit is contained in:
MrBandaruk 2020-02-22 17:27:18 +01:00
parent 43f16e879e
commit fdb63cfd46

View file

@ -205,7 +205,7 @@ namespace TLSharp.Core.Network
return HandleBadServerSalt(messageId, sequence, messageReader, request, token); return HandleBadServerSalt(messageId, sequence, messageReader, request, token);
case 0xa7eff811: // bad_msg_notification case 0xa7eff811: // bad_msg_notification
//logger.debug("MSG 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 case 0x276d3ec6: // msg_detailed_info
//logger.debug("MSG msg_detailed_info"); //logger.debug("MSG msg_detailed_info");
return HandleMsgDetailedInfo(messageId, sequence, messageReader); return HandleMsgDetailedInfo(messageId, sequence, messageReader);
@ -374,7 +374,7 @@ namespace TLSharp.Core.Network
return false; 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(); uint code = messageReader.ReadUInt32();
ulong requestId = messageReader.ReadUInt64(); ulong requestId = messageReader.ReadUInt64();
@ -394,7 +394,10 @@ namespace TLSharp.Core.Network
case 20: 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"); 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: 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: 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)"); 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: case 34: