diff --git a/TLSharp.Core/TelegramClient.cs b/TLSharp.Core/TelegramClient.cs index f8f05a3..7cf7e5d 100644 --- a/TLSharp.Core/TelegramClient.cs +++ b/TLSharp.Core/TelegramClient.cs @@ -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