Don't do anything on .connect() if it's already connected

This commit is contained in:
Lonami Exo
2017-06-19 09:58:03 +02:00
parent daa626aa04
commit 697434be37
3 changed files with 12 additions and 0 deletions

View File

@@ -79,6 +79,12 @@ class TelegramBareClient:
If 'exported_auth' is not None, it will be used instead to
determine the authorization key for the current session.
"""
if self.sender and self.sender.is_connected():
self._logger.warning(
'Attempted to connect when the client was already connected.'
)
return
transport = TcpTransport(self.session.server_address,
self.session.port, proxy=self.proxy)