Merge pull request #344 from salarcode/master

Implement IDisposable in TelegramClient class
This commit is contained in:
Andres G. Aragoneses 2016-12-16 15:00:46 +08:00 committed by GitHub
commit 6d73c0e964

View file

@ -21,7 +21,7 @@ using TLAuthorization = TeleSharp.TL.Auth.TLAuthorization;
namespace TLSharp.Core
{
public class TelegramClient
public class TelegramClient : IDisposable
{
private MtProtoSender _sender;
private AuthKey _key;
@ -344,6 +344,15 @@ namespace TLSharp.Core
_session.Save();
}
public void Dispose()
{
if (_transport != null)
{
_transport.Dispose();
_transport = null;
}
}
}
public class MissingApiConfigurationException : Exception