New flag to mask event reporting. This is necessary so that Initialisation doesn't get interrupted by any event.

This commit is contained in:
Paulo Rogerio Panhoto 2018-03-01 14:10:03 -03:00
parent b98914ed55
commit 01e61f3ea4
2 changed files with 5 additions and 2 deletions

View file

@ -262,7 +262,7 @@ namespace TLSharp.Core.Network
}
catch (Exception ex)
{
logger.Error($"HandleUpdate failed: {ex}");
logger.Debug($"HandleUpdate failed: {ex}");
}
return false;
}

View file

@ -41,6 +41,8 @@ namespace TLSharp.Core
public Session Session { get { return _session; } }
public volatile bool AllowEvents = false;
public TelegramClient(int apiId, string apiHash,
Session session = null, string sessionUserId = "session", TcpClientConnectionHandler handler = null)
{
@ -158,7 +160,8 @@ namespace TLSharp.Core
private void _sender_UpdatesEvent (TLAbsUpdates updates)
{
Updates?.Invoke (this, updates);
if (AllowEvents && Updates != null)
Updates(this, updates);
}
private async Task RequestWithDcMigration(TLMethod request)