Server discovery: no need to recreate a client
This commit is contained in:
parent
758edd8a6a
commit
09ae0d7776
|
@ -143,16 +143,13 @@ class Backend:
|
||||||
client = MatrixClient(self, homeserver=homeserver)
|
client = MatrixClient(self, homeserver=homeserver)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
homeserver = (await client.discovery_info()).homeserver_url
|
client.homeserver = (await client.discovery_info()).homeserver_url
|
||||||
except (MatrixNotFound, MatrixForbidden):
|
except (MatrixNotFound, MatrixForbidden):
|
||||||
# This is either already the real URL, or an invalid URL.
|
# This is either already the real URL, or an invalid URL.
|
||||||
pass
|
pass
|
||||||
else:
|
|
||||||
await client.close()
|
|
||||||
client = MatrixClient(self, homeserver=homeserver)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return (homeserver, (await client.login_info()).flows)
|
return (client.homeserver, (await client.login_info()).flows)
|
||||||
finally:
|
finally:
|
||||||
await client.close()
|
await client.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user