mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
wip(sync): only open listen connections after authentication
This commit is contained in:
parent
698c74b427
commit
460a0c9997
1 changed files with 3 additions and 0 deletions
|
@ -75,6 +75,8 @@ class Peer(models.Model):
|
||||||
**connection_params,
|
**connection_params,
|
||||||
autocommit=True,
|
autocommit=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def listen(self):
|
||||||
asyncio.create_task(self.listen_public())
|
asyncio.create_task(self.listen_public())
|
||||||
asyncio.create_task(self.listen_private())
|
asyncio.create_task(self.listen_private())
|
||||||
|
|
||||||
|
@ -116,6 +118,7 @@ class Peer(models.Model):
|
||||||
if "edit" not in permissions:
|
if "edit" not in permissions:
|
||||||
return await self.disconnect()
|
return await self.disconnect()
|
||||||
await self.asave()
|
await self.asave()
|
||||||
|
await self.listen()
|
||||||
response = JoinResponse(uuid=str(self.uuid), peers=await self.get_peers())
|
response = JoinResponse(uuid=str(self.uuid), peers=await self.get_peers())
|
||||||
await self.send(response.model_dump_json())
|
await self.send(response.model_dump_json())
|
||||||
await self.send_peers_list()
|
await self.send_peers_list()
|
||||||
|
|
Loading…
Reference in a new issue