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