Skip to content
Snippets Groups Projects
Commit 6eb4f69d authored by Bruce Flynn's avatar Bruce Flynn
Browse files

Handle PacketTooShort in edosl0info

parent 250fe6d9
No related branches found
No related tags found
No related merge requests found
...@@ -59,10 +59,20 @@ def cmd_info(): ...@@ -59,10 +59,20 @@ def cmd_info():
args = parser.parse_args() args = parser.parse_args()
_configure_logging(args) _configure_logging(args)
num_packets = 0
packets = stream.PacketStream(io.open(args.filepath, 'rb')) packets = stream.PacketStream(io.open(args.filepath, 'rb'))
first = datetime(3000, 1, 1) first = datetime(3000, 1, 1)
last = datetime(1970, 1, 1) last = datetime(1970, 1, 1)
for packet in packets: while True:
try:
packet = packets.next()
num_packets += 1
except stream.PacketTooShort as err:
LOG.warn("corrupt packet stream after %d packets: %s",
num_packets, err)
break
except StopIteration:
break
if packet.stamp: if packet.stamp:
first = min(packet.stamp, first) first = min(packet.stamp, first)
last = max(packet.stamp, last) last = max(packet.stamp, last)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment