Skip to content
Snippets Groups Projects
Commit f01f0e13 authored by 's avatar
Browse files

Made more robust _PcapWrapper_pypcap.next() by handling if self.pcap.next() returns None.

parent 7575e4f3
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,10 @@ if conf.use_pcap: ...@@ -53,7 +53,10 @@ if conf.use_pcap:
def __del__(self): def __del__(self):
warning("__del__: don't know how to close the file descriptor. Bugs ahead ! Please report this bug.") warning("__del__: don't know how to close the file descriptor. Bugs ahead ! Please report this bug.")
def next(self): def next(self):
ts, pkt = self.pcap.next() c = self.pcap.next()
if c is None
return
ts, pkt = c
return ts, str(pkt) return ts, str(pkt)
open_pcap = lambda *args,**kargs: _PcapWrapper_pypcap(*args,**kargs) open_pcap = lambda *args,**kargs: _PcapWrapper_pypcap(*args,**kargs)
elif hasattr(pcap,"pcapObject"): # python-libpcap elif hasattr(pcap,"pcapObject"): # python-libpcap
......
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