[Git][NTPsec/ntpsec][master] ntpd: ignore corrupted log lines.
Gary E. Miller
gitlab at mg.gitlab.com
Fri Oct 28 02:03:07 UTC 2016
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
84bd1d88 by Gary E. Miller at 2016-10-27T19:01:46-07:00
ntpd: ignore corrupted log lines.
- - - - -
1 changed file:
- ntpstats/ntpviz
Changes:
=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -323,20 +323,26 @@ set rmargin 10
last_time = 0
if item2:
for row in rows:
- if 1024000 < row[0] - last_time:
- # data loss, add a break in the plot line
- plot_data += '\n'
- last_time = row[0]
- # fields: time, fld, and rtt
- plot_data += row[1] + ' ' + row[item1] + ' ' + row[item2] + '\n'
+ try:
+ if 1024000 < row[0] - last_time:
+ # data loss, add a break in the plot line
+ plot_data += '\n'
+ # fields: time, fld, and rtt
+ plot_data += row[1] + ' ' + row[item1] + ' ' + row[item2] + '\n'
+ last_time = row[0]
+ except IndexError:
+ pass
else:
for row in rows:
- if 1024000 < row[0] - last_time:
- # data loss, add a break in the plot line
- plot_data += '\n'
- last_time = row[0]
- # fields: time, fld
- plot_data += row[1] + ' ' + row[item1] + '\n'
+ try:
+ if 1024000 < row[0] - last_time:
+ # data loss, add a break in the plot line
+ plot_data += '\n'
+ # fields: time, fld
+ plot_data += row[1] + ' ' + row[item1] + '\n'
+ last_time = row[0]
+ except IndexError:
+ pass
# I know you want to replace the plot_data string concat with
# or more join()s, do not do it, it is slower
# next you'll want to try %-substitution. it too is slower
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/84bd1d882185715cd858f88a5f7f0b8343f31b40
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161028/3767d914/attachment.html>
More information about the vc
mailing list