From 460a0c9997e0cb2b545bc92a5853fc2001560614 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 2 Jan 2025 17:43:12 +0100 Subject: [PATCH] wip(sync): only open listen connections after authentication --- umap/sync/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/umap/sync/models.py b/umap/sync/models.py index c3bbccfe..18a40076 100644 --- a/umap/sync/models.py +++ b/umap/sync/models.py @@ -75,6 +75,8 @@ class Peer(models.Model): **connection_params, autocommit=True, ) + + async def listen(self): asyncio.create_task(self.listen_public()) asyncio.create_task(self.listen_private()) @@ -116,6 +118,7 @@ class Peer(models.Model): if "edit" not in permissions: return await self.disconnect() await self.asave() + await self.listen() response = JoinResponse(uuid=str(self.uuid), peers=await self.get_peers()) await self.send(response.model_dump_json()) await self.send_peers_list()