Only print gateware/software mismatch warning once per process.

This commit is contained in:
whitequark 2017-12-26 21:13:46 +00:00
parent b31b59f7ca
commit a2bc12da68
1 changed files with 4 additions and 1 deletions

View File

@ -136,6 +136,8 @@ class CommKernelDummy:
class CommKernel: class CommKernel:
warned_of_mismatch = False
def __init__(self, host, port=1381): def __init__(self, host, port=1381):
self._read_type = None self._read_type = None
self.host = host self.host = host
@ -284,10 +286,11 @@ class CommKernel:
.format(runtime_id)) .format(runtime_id))
gateware_version = self._read_string() gateware_version = self._read_string()
if gateware_version != software_version: if gateware_version != software_version and not self.warned_of_mismatch:
logger.warning("Mismatch between gateware (%s) " logger.warning("Mismatch between gateware (%s) "
"and software (%s) versions", "and software (%s) versions",
gateware_version, software_version) gateware_version, software_version)
CommKernel.warned_of_mismatch = True
finished_cleanly = self._read_bool() finished_cleanly = self._read_bool()
if not finished_cleanly: if not finished_cleanly: