1
0
mirror of https://github.com/JoelBender/bacpypes synced 2025-10-05 22:18:16 +08:00

sync the py34 changes with py27 #173

This commit is contained in:
Joel Bender 2018-03-06 13:51:50 -05:00
parent 48f55e0b73
commit 2fb24ae22e
2 changed files with 7 additions and 5 deletions

View File

@ -355,16 +355,17 @@ def decode_file(fname):
if not pcap:
raise RuntimeError("failed to import pcap")
# create a pcap object
# create a pcap object, reading from the file
p = pcap.pcap(fname)
for timestamp, data in p:
# loop through the packets
for i, (timestamp, data) in enumerate(p):
pkt = decode_packet(data)
if not pkt:
continue
# save the index and timestamp in the packet
# pkt._index = i
# save the packet number (as viewed in Wireshark) and timestamp
pkt._number = i + 1
pkt._timestamp = timestamp
yield pkt

View File

@ -355,9 +355,10 @@ def decode_file(fname):
if not pcap:
raise RuntimeError("failed to import pcap")
# create a pcap object
# create a pcap object, reading from the file
p = pcap.pcap(fname)
# loop through the packets
for i, (timestamp, data) in enumerate(p):
pkt = decode_packet(data)
if not pkt: