[svn-commits] twilson: testsuite/asterisk/trunk r2988 - /asterisk/trunk/lib/python/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jan 12 10:19:27 CST 2012


Author: twilson
Date: Thu Jan 12 10:19:24 2012
New Revision: 2988

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=2988
Log:
Handle change of setfilter -> filter property in yappcap

Modified:
    asterisk/trunk/lib/python/pcap_listener.py

Modified: asterisk/trunk/lib/python/pcap_listener.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/pcap_listener.py?view=diff&rev=2988&r1=2987&r2=2988
==============================================================================
--- asterisk/trunk/lib/python/pcap_listener.py (original)
+++ asterisk/trunk/lib/python/pcap_listener.py Thu Jan 12 10:19:24 2012
@@ -1,17 +1,17 @@
 from twisted.internet import abstract, protocol
-from yappcap import PcapLive, findalldevs
+from yappcap import PcapLive, findalldevs, PcapTimeout
 
 class PcapFile(abstract.FileDescriptor):
     """Treat a live pcap capture as a file for Twisted to call select() on"""
-    def __init__(self, protocol, interface, filter=None, dumpfile=None):
+    def __init__(self, protocol, interface, xfilter=None, dumpfile=None):
         abstract.FileDescriptor.__init__(self)
 
         p = PcapLive(interface, autosave=dumpfile)
         p.activate()
         p.blocking = False
 
-        if filter is not None:
-            p.setfilter(filter)
+        if xfilter is not None:
+            p.filter = xfilter
 
         self.pcap = p
         self.fd = p.fileno
@@ -23,7 +23,10 @@
         return self.fd
 
     def doRead(self):
-        pkt = self.pcap.next()
+        try:
+            pkt = self.pcap.next()
+        except PcapTimeout:
+            return 0
 
         # we may not have a packet if something weird happens
         if not pkt:




More information about the svn-commits mailing list