* HandleUpdate fixed for the case where there are no subscribers.

* main event loop added to TelegramClient as a single function call.
This commit is contained in:
Paulo Rogerio Panhoto 2018-01-05 11:12:41 -02:00
parent 76362061f6
commit 936a26c6bd
2 changed files with 10 additions and 1 deletions

View file

@ -330,6 +330,7 @@ namespace TLSharp.Core.Network
{ // rpc_error { // rpc_error
int errorCode = messageReader.ReadInt32(); int errorCode = messageReader.ReadInt32();
string errorMessage = Serializers.String.read(messageReader); string errorMessage = Serializers.String.read(messageReader);
Console.Error.WriteLine($"ERROR: {errorMessage} - {errorCode}");
if (errorMessage.StartsWith("FLOOD_WAIT_")) if (errorMessage.StartsWith("FLOOD_WAIT_"))
{ {

View file

@ -113,9 +113,17 @@ namespace TLSharp.Core
} }
} }
public async Task MainLoopAsync()
{
for (;;)
{
await WaitEventAsync();
}
}
private void _sender_UpdatesEvent (TLAbsUpdates updates) private void _sender_UpdatesEvent (TLAbsUpdates updates)
{ {
Updates (this, updates); Updates?.Invoke (this, updates);
} }
private async Task RequestWithDcMigration(TLMethod request) private async Task RequestWithDcMigration(TLMethod request)