Skip to content

Commit

Permalink
fixes #145 (#135) - mtr still processing binary strings
Browse files Browse the repository at this point in the history
  • Loading branch information
vegu committed Nov 12, 2021
1 parent 2431814 commit 285c425
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/vaping/plugins/fping_mtr.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,10 @@ def parse_traceroute_line(self, line):
host (`str`)
"""
try:
host = line.split()[1]
if host != "*":
try:
return host.decode("ascii")
except AttributeError:
# No `decode` on `str` in py3
# assume already decoded str
return host
host = line.split()[1].decode("utf8")
# TODO: do something else if host == "*"?
if host.strip("*\n"):
return host

except Exception as e:
logging.error(f"failed to get data {e}")
Expand All @@ -74,11 +70,6 @@ def parse_traceroute(self, it):
if self.lines_read == 1:
continue

# skip *
# TODO: do something else here?
if line[0] == "*":
continue

host = self.parse_traceroute_line(line)
if host and host not in hosts:
hosts.append(host)
Expand Down

0 comments on commit 285c425

Please sign in to comment.