From 795b8ae4c67d6b25db885c03ddf19d9d556ccaa7 Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Wed, 14 Feb 2024 17:39:14 +0800 Subject: [PATCH] add analyzer proxy magic --- artiq/coredevice/comm_analyzer.py | 4 +++- artiq/frontend/aqctl_coreanalyzer_proxy.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/artiq/coredevice/comm_analyzer.py b/artiq/coredevice/comm_analyzer.py index 9a175fc8c..9fd592162 100644 --- a/artiq/coredevice/comm_analyzer.py +++ b/artiq/coredevice/comm_analyzer.py @@ -15,6 +15,7 @@ logger = logging.getLogger(__name__) DEFAULT_REF_PERIOD = 1e-9 +ANALYZER_MAGIC = b"ARTIQ Analyzer Proxy\n" class MessageType(Enum): @@ -156,8 +157,9 @@ class AnalyzerProxyReceiver: async def connect(self, host, port): self.reader, self.writer = \ await keepalive.async_open_connection(host, port) - magic = get_analyzer_magic() try: + line = await self.reader.readline() + assert line == ANALYZER_MAGIC self.receive_task = asyncio.create_task(self._receive_cr()) except: if self.writer is not None: diff --git a/artiq/frontend/aqctl_coreanalyzer_proxy.py b/artiq/frontend/aqctl_coreanalyzer_proxy.py index 8a2bee56e..34726e47a 100755 --- a/artiq/frontend/aqctl_coreanalyzer_proxy.py +++ b/artiq/frontend/aqctl_coreanalyzer_proxy.py @@ -9,7 +9,7 @@ from sipyco.asyncio_tools import AsyncioServer, SignalHandler, atexit_register_c from sipyco.pc_rpc import Server from sipyco import common_args -from artiq.coredevice.comm_analyzer import get_analyzer_dump +from artiq.coredevice.comm_analyzer import get_analyzer_dump, ANALYZER_MAGIC logger = logging.getLogger(__name__) @@ -24,6 +24,7 @@ class ProxyServer(AsyncioServer): async def _handle_connection_cr(self, reader, writer): try: + writer.write(ANALYZER_MAGIC) queue = asyncio.Queue(self._queue_limit) self._recipients.add(queue) try: