sets the _looping flag to true right from the constructor so if Close() is called before the loop starts, the client will never loop for events.

This commit is contained in:
Paulo Rogerio Panhoto 2018-03-08 16:38:30 -03:00
parent 4c112086aa
commit 8180ee94f0

View file

@ -31,7 +31,7 @@ namespace TLSharp.Core
private Session _session;
private List<TLDcOption> dcOptions;
private TcpClientConnectionHandler _handler;
private bool _looping;
private bool _looping = true;
public delegate void UpdatesEvent (TelegramClient source, TLAbsUpdates updates);
public delegate void ClientEvent(TelegramClient source);
@ -131,7 +131,6 @@ namespace TLSharp.Core
logger.Trace("Entered loop");
var lastPing = DateTime.UtcNow;
await SendPingAsync();
_looping = true;
while (_looping)
{
try