From 7fb6b3db219e5859a3fc477cae6b7e7a76fe22c5 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 25 May 2016 10:30:59 -0500 Subject: [PATCH] protocols/broadcast: minor fixes --- artiq/protocols/broadcast.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/artiq/protocols/broadcast.py b/artiq/protocols/broadcast.py index b91269845..636bad6e1 100644 --- a/artiq/protocols/broadcast.py +++ b/artiq/protocols/broadcast.py @@ -52,9 +52,9 @@ class Receiver: class Broadcaster(AsyncioServer): - def __init__(self): - AsyncioServer.__init__(self, maxbuf=1024) - self._maxbuf = maxbuf + def __init__(self, queue_limit=1024): + AsyncioServer.__init__(self) + self._queue_limit = queue_limit self._recipients = dict() async def _handle_connection_cr(self, reader, writer): @@ -68,7 +68,7 @@ class Broadcaster(AsyncioServer): return name = line.decode()[:-1] - queue = asyncio.Queue(self._maxbuf) + queue = asyncio.Queue(self._queue_limit) if name in self._recipients: self._recipients[name].add(queue) else: @@ -97,5 +97,6 @@ class Broadcaster(AsyncioServer): try: recipient.put_nowait(line) except asyncio.QueueFull: - # do not log as logs may be redirected to a Broadcaster + # do not log: log messages may be sent back to us + # as broadcasts, and cause infinite recursion. pass