Skip to content
Snippets Groups Projects
Commit 4a58c78d authored by Your Name's avatar Your Name
Browse files

Merge branch 'master' of https://gitlab.cern.ch/hev-sw/hev-sw

parents affcd59c d5a8f6b1
Branches
No related merge requests found
......@@ -199,12 +199,11 @@ class HEVServer(object):
addr = writer.get_extra_info("peername")
logging.info(f"Broadcasting to {addr!r}")
bindex = len(self._broadcasts) # index of current broadcast client's queue in broadcasts
self._broadcasts.append(asyncio.Queue(maxsize=16)) # append new queue
self._broadcasts[addr[1]] = asyncio.Queue(maxsize=16) # append new queue
while self._broadcasting:
# wait for data from queue
payload = await self._broadcasts[bindex].get()
payload = await self._broadcasts[addr[1]].get()
# Alarm is latched until acknowledged in GUI
if payload.getType() == PAYLOAD_TYPE.ALARM:
if payload not in self._alarms:
......@@ -222,7 +221,7 @@ class HEVServer(object):
broadcast_packet[data_type] = payload.getDict()
broadcast_packet["alarms"] = [alarm.getDict() for alarm in alarms] if alarms is not None else []
self._broadcasts[bindex].task_done()
self._broadcasts[addr[1]].task_done()
logging.info(f"Send data for timestamp: {broadcast_packet[data_type]['timestamp']}")
logging.debug(f"Send: {json.dumps(broadcast_packet,indent=4)}")
......@@ -238,7 +237,7 @@ class HEVServer(object):
self._broadcasting = True
writer.close()
del self._broadcasts[bindex]
del self._broadcasts[addr[1]]
async def serve_request(self, ip: str, port: int) -> None:
server = await asyncio.start_server(
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment