From 624072c111221e7ed176fb9034ada9084dba5cef Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 2 Jan 2018 08:18:45 +0100 Subject: [PATCH] hush more lgtm.com -discovered static-analysis problems --- src/wormhole/cli/cmd_receive.py | 1 + src/wormhole/ipaddrs.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/wormhole/cli/cmd_receive.py b/src/wormhole/cli/cmd_receive.py index 03357ca..aa7f3a2 100644 --- a/src/wormhole/cli/cmd_receive.py +++ b/src/wormhole/cli/cmd_receive.py @@ -164,6 +164,7 @@ class Receiver: recognized = True if not want_offer: raise TransferError("duplicate offer") + want_offer = False try: yield self._parse_offer(them_d[u"offer"], w) except RespondError as r: diff --git a/src/wormhole/ipaddrs.py b/src/wormhole/ipaddrs.py index 161c219..2f35d55 100644 --- a/src/wormhole/ipaddrs.py +++ b/src/wormhole/ipaddrs.py @@ -56,8 +56,9 @@ def find_addresses(): def _query(path, args, regex): env = {'LANG': 'en_US.UTF-8'} - TRIES = 5 - for trial in range(TRIES): + trial = 0 + while True: + trial += 1 try: p = subprocess.Popen([path] + list(args), stdout=subprocess.PIPE, @@ -67,7 +68,7 @@ def _query(path, args, regex): (output, err) = p.communicate() break except OSError as e: - if e.errno == errno.EINTR and trial < TRIES-1: + if e.errno == errno.EINTR and trial < 5: continue raise