Fix reconnect always returning False -> infinite loop

This commit is contained in:
Lonami Exo 2017-09-22 12:45:14 +02:00
parent 4d5f16f2aa
commit d8bf8bb2eb

View File

@ -195,7 +195,9 @@ class TelegramBareClient:
with self._connect_lock:
# Another thread may have connected again, so check that first
if not self.is_connected():
self.connect()
return self.connect()
else:
return True
else:
self.disconnect()
self.session.auth_key = None # Force creating new auth_key
@ -204,7 +206,7 @@ class TelegramBareClient:
self._sender.connection.ip = self.session.server_address = ip
self._sender.connection.port = self.session.port = dc.port
self.session.save()
self.connect()
return self.connect()
# endregion