forked from M-Labs/artiq
add analyzer proxy magic
This commit is contained in:
parent
21b77567f2
commit
795b8ae4c6
|
@ -15,6 +15,7 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_REF_PERIOD = 1e-9
|
DEFAULT_REF_PERIOD = 1e-9
|
||||||
|
ANALYZER_MAGIC = b"ARTIQ Analyzer Proxy\n"
|
||||||
|
|
||||||
|
|
||||||
class MessageType(Enum):
|
class MessageType(Enum):
|
||||||
|
@ -156,8 +157,9 @@ class AnalyzerProxyReceiver:
|
||||||
async def connect(self, host, port):
|
async def connect(self, host, port):
|
||||||
self.reader, self.writer = \
|
self.reader, self.writer = \
|
||||||
await keepalive.async_open_connection(host, port)
|
await keepalive.async_open_connection(host, port)
|
||||||
magic = get_analyzer_magic()
|
|
||||||
try:
|
try:
|
||||||
|
line = await self.reader.readline()
|
||||||
|
assert line == ANALYZER_MAGIC
|
||||||
self.receive_task = asyncio.create_task(self._receive_cr())
|
self.receive_task = asyncio.create_task(self._receive_cr())
|
||||||
except:
|
except:
|
||||||
if self.writer is not None:
|
if self.writer is not None:
|
||||||
|
|
|
@ -9,7 +9,7 @@ from sipyco.asyncio_tools import AsyncioServer, SignalHandler, atexit_register_c
|
||||||
from sipyco.pc_rpc import Server
|
from sipyco.pc_rpc import Server
|
||||||
from sipyco import common_args
|
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__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -24,6 +24,7 @@ class ProxyServer(AsyncioServer):
|
||||||
|
|
||||||
async def _handle_connection_cr(self, reader, writer):
|
async def _handle_connection_cr(self, reader, writer):
|
||||||
try:
|
try:
|
||||||
|
writer.write(ANALYZER_MAGIC)
|
||||||
queue = asyncio.Queue(self._queue_limit)
|
queue = asyncio.Queue(self._queue_limit)
|
||||||
self._recipients.add(queue)
|
self._recipients.add(queue)
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue