diff options
author | Devaev Maxim <[email protected]> | 2020-06-04 05:52:50 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-06-04 05:52:50 +0300 |
commit | be9ce4e4ffa418ba64612efdabee116dd59a6f5d (patch) | |
tree | 15cd29983c46c7e15505c6e22dd81330ed1bdd35 /kvmd | |
parent | 333908b6a15074c17b31c3be14e82a17ac959138 (diff) |
serial: decrease common_retries with read_retries
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/plugins/hid/serial.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/kvmd/plugins/hid/serial.py b/kvmd/plugins/hid/serial.py index c41c762c..0af31eca 100644 --- a/kvmd/plugins/hid/serial.py +++ b/kvmd/plugins/hid/serial.py @@ -313,9 +313,9 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst def __process_request(self, tty: serial.Serial, request: bytes) -> None: # pylint: disable=too-many-branches logger = get_logger() + common_error_occured = False common_retries = self.__common_retries read_retries = self.__read_retries - error_occured = False while common_retries and read_retries: if not self.__noop: @@ -351,7 +351,7 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst self.__state_flags.update(online=True) return elif code == 0x20: # Done - if error_occured: + if common_error_occured: logger.info("Success!") self.__state_flags.update(online=True) return @@ -366,9 +366,8 @@ class Plugin(BaseHid, multiprocessing.Process): # pylint: disable=too-many-inst else: logger.error("Invalid response from HID: request=%r; code=0x%x", request, code) - common_retries -= 1 - - error_occured = True + common_error_occured = True + common_retries -= 1 self.__state_flags.update(online=False) if common_retries and read_retries: |