def process_indicator(self, reply):
cmd, timeout = None, None
for match in re.findall(r'\[.*\]', reply):
match = match.strip()
match = match.replace(' ', '')
if match == '[loopback=0]':
self.cancel_timer()
return
match = match.replace(']', '')
match = match.replace('[', '')
if '=' in match:
cmd, timeout = match.split('=')
self.timeout = float(timeout)/1000
else:
cmd = match
cmd = '[{}]'.format(cmd)
if self.timeout is not None and cmd is not None:
self.cancel_timer()
self.timer = threading.Timer(self.timeout, self.ask, (cmd, ))
self.timer.start()
logger.info("Start {} timer with timeout {}".format(
cmd, self.timeout))
评论列表
文章目录