[Git][NTPsec/ntpsec][master] Simplify gethostbyname() handling
Gary E. Miller
gitlab at mg.gitlab.com
Thu Sep 8 06:52:01 UTC 2016
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
c297c800 by Gary E. Miller at 2016-09-07T23:51:34-07:00
Simplify gethostbyname() handling
- - - - -
1 changed file:
- ntpstats/ntpviz
Changes:
=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -306,14 +306,11 @@ plot \
# The socket.gethostbyname() call maps DNS names to IP addresses,
# passing through literal IPv4 addresses unaltered. However,
# it barfs on either literal IPv6 addresses or refclock names.
- if "(" in key or "::" in key:
+ try:
+ ip = socket.gethostbyname(key)
+ except:
+ # ignore it
ip = key
- else:
- try:
- ip = socket.gethostbyname(key)
- except:
- # ignore it
- ip = key
if ip in peerdict:
plot_data += "\n".join(peerdict[ip]) + "\ne\n"
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c297c8006e2c0fee20127c43e1a01e6c78e7597a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160908/92a48c04/attachment.html>
More information about the vc
mailing list