Fix connection parameters not being copied on reconnection (#129)

This commit is contained in:
Lonami Exo
2017-06-17 22:04:29 +02:00
parent be33ae4e80
commit 765ae870cf
2 changed files with 24 additions and 7 deletions

View File

@@ -181,7 +181,10 @@ class TelegramClient(TelegramBareClient):
# Create a temporary session for this IP address, which needs
# to be different because each auth_key is unique per DC.
session = JsonSession(None)
#
# Construct this session with the connection parameters
# (system version, device model...) from the current one.
session = JsonSession(self.session)
session.server_address = dc.ip_address
session.port = dc.port
client = TelegramBareClient(session, self.api_id, self.api_hash)