Server discovery: no need to recreate a client

This commit is contained in:
miruka 2020-07-30 22:59:24 -04:00
parent 758edd8a6a
commit 09ae0d7776

View File

@ -143,16 +143,13 @@ class Backend:
client = MatrixClient(self, homeserver=homeserver)
try:
homeserver = (await client.discovery_info()).homeserver_url
client.homeserver = (await client.discovery_info()).homeserver_url
except (MatrixNotFound, MatrixForbidden):
# This is either already the real URL, or an invalid URL.
pass
else:
await client.close()
client = MatrixClient(self, homeserver=homeserver)
try:
return (homeserver, (await client.login_info()).flows)
return (client.homeserver, (await client.login_info()).flows)
finally:
await client.close()