Aleksey TwoWay 10546
Dimitry TwoWay 10650
f1import asynciof1import asyncio
22
3class Portal(asyncio.Barrier):3class Portal(asyncio.Barrier):
44
n5    def __init__(self, parties):n5    def __init__(self, count):
6        super().__init__(parties)6        super().__init__(count)
7        self.topic = None7        self.topic = None
n8        self._proposed_topic = Nonen8        self._tmp = None
9        self._out_barrier = asyncio.Barrier(parties)9        self._sync = asyncio.Barrier(count)
1010
n11    async def wait(self, topic=None):n11    async def wait(self, t=None):
12        if topic is not None:12        if t is not None:
13            self._proposed_topic = topic13            self._tmp = t
14        idx = await super().wait()14        pos = await super().wait()
15        if idx == 0:15        if pos == 0:
16            self.topic = self._proposed_topic16            self.topic = self._tmp
17        await self._out_barrier.wait()17        await self._sync.wait()
18        return idx18        return pos
1919
20    async def reset(self):20    async def reset(self):
21        self.topic = None21        self.topic = None
n22        self._proposed_topic = Nonen22        self._tmp = None
23        await super().reset()23        await super().reset()
t24        await self._out_barrier.reset()t24        await self._sync.reset()
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op