forked from M-Labs/artiq
1
0
Fork 0

comm_moninj: set keepalive for socket (#1843)

This commit is contained in:
Steve Fan 2022-02-04 13:51:19 +08:00 committed by GitHub
parent e45cb217be
commit 798a412c6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -2,7 +2,7 @@ import asyncio
import logging import logging
import struct import struct
from enum import Enum from enum import Enum
from .comm import set_keepalive
__all__ = ["TTLProbe", "TTLOverride", "CommMonInj"] __all__ = ["TTLProbe", "TTLOverride", "CommMonInj"]
@ -29,6 +29,8 @@ class CommMonInj:
async def connect(self, host, port=1383): async def connect(self, host, port=1383):
self._reader, self._writer = await asyncio.open_connection(host, port) self._reader, self._writer = await asyncio.open_connection(host, port)
set_keepalive(self._writer.transport.get_extra_info('socket'), 1, 1, 3)
try: try:
self._writer.write(b"ARTIQ moninj\n") self._writer.write(b"ARTIQ moninj\n")
# get device endian # get device endian