Initialize session on reconnection

This commit is contained in:
Dan 2022-02-10 05:34:21 +01:00
parent f23422cb25
commit 5889c67fb5

View File

@ -271,6 +271,27 @@ class Session:
if not packet:
await self.connection.reconnect()
try:
await self._send(
raw.functions.InvokeWithLayer(
layer=layer,
query=raw.functions.InitConnection(
api_id=self.client.api_id,
app_version=self.client.app_version,
device_model=self.client.device_model,
system_version=self.client.system_version,
system_lang_code=self.client.lang_code,
lang_code=self.client.lang_code,
lang_pack="",
query=raw.functions.help.GetConfig(),
)
),
wait_response=False
)
except (OSError, TimeoutError, RPCError):
pass
continue
if len(packet) == 4: