resolved PR comments

This commit is contained in:
mark 2020-05-12 23:30:12 +01:00
parent f258b6ede8
commit 2d540787e7
3 changed files with 11 additions and 17 deletions

View file

@ -139,7 +139,7 @@ Full code you can see at [DownloadFileFromContactTest](https://github.com/sochix
# Events Sample code # Events Sample code
```csharp ```csharp
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using TeleSharp.TL; using TeleSharp.TL;
using TLSharp.Core; using TLSharp.Core;
@ -273,7 +273,7 @@ namespace TLSharpPOC
} }
// -- Wait in a loop to handle incoming updates. No need to poll. // -- Wait in a loop to handle incoming updates. No need to poll.
for (; ; ) while(true)
{ {
await client.WaitEventAsync(TimeSpan.FromSeconds(1)); await client.WaitEventAsync(TimeSpan.FromSeconds(1));
} }

View file

@ -268,8 +268,6 @@ namespace TLSharp.Core.Network
} }
private bool HandleUpdate(uint code, int sequence, BinaryReader messageReader, TLMethod request) private bool HandleUpdate(uint code, int sequence, BinaryReader messageReader, TLMethod request)
{
try
{ {
var update = ParseUpdate(code, messageReader); var update = ParseUpdate(code, messageReader);
if (update != null && UpdatesEvent != null) if (update != null && UpdatesEvent != null)
@ -278,11 +276,6 @@ namespace TLSharp.Core.Network
} }
return true; return true;
} }
catch (Exception e)
{
return false;
}
}
private TLAbsUpdates ParseUpdate(uint code, BinaryReader messageReader) private TLAbsUpdates ParseUpdate(uint code, BinaryReader messageReader)
{ {

View file

@ -382,6 +382,7 @@ namespace TLSharp.Tests
{ {
IList<TLMessage> newMsgs = new List<TLMessage>(); IList<TLMessage> newMsgs = new List<TLMessage>();
TLUser user = null; TLUser user = null;
var updateMsg = "Send yourself an UPDATE_1 message to trigger update during loop";
var client = NewClient(); var client = NewClient();
await client.ConnectAsync(); await client.ConnectAsync();
@ -435,8 +436,8 @@ namespace TLSharp.Tests
} }
}; };
Console.WriteLine("Send yourself an UPDATE_1 message to trigger update during loop"); Console.WriteLine(updateMsg);
Debug.WriteLine("Send yourself an UPDATE_1 message to trigger update during loop"); Debug.WriteLine(updateMsg);
await client.MainLoopAsync(new TimeSpan(0, 0, 1)); await client.MainLoopAsync(new TimeSpan(0, 0, 1));