def filter(self, code, optimize=True, netmask=0): if hasattr(self, "_fp"): cpcap.freecode(self._fp) if code: self._fp = cpcap.filter(self._p, code, optimize, netmask)
def __del__(self): if hasattr(self, "_fp"): cpcap.freecode(self._fp) cpcap.close(self._p) del self._p