From 4ba12e717f16412dc7aa0bb11b4117f4e7660d6d Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Thu, 21 Sep 2017 13:58:57 +0200 Subject: [PATCH] Fix reconnect to new_dc wasn't changing connection.ip --- telethon/telegram_bare_client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/telethon/telegram_bare_client.py b/telethon/telegram_bare_client.py index e0e4673b..2f2f0df9 100644 --- a/telethon/telegram_bare_client.py +++ b/telethon/telegram_bare_client.py @@ -120,7 +120,6 @@ class TelegramBareClient: else: init_connection = self.session.layer != LAYER - if init_connection: if exported_auth is not None: self._init_connection(ImportAuthorizationRequest( @@ -188,8 +187,9 @@ class TelegramBareClient: if new_dc is not None: self.session.auth_key = None # Force creating new auth_key dc = self._get_dc(new_dc) - self.session.server_address = dc.ip_address - self.session.port = dc.port + ip = dc.ip_address + self._sender.connection.ip = self.session.server_address = ip + self._sender.connection.port = self.session.port = dc.port self.session.save() self.connect()