[tor-commits] [ooni-probe/master] Fix bug that lead to sniffer not being unregistered properly.

art at torproject.org art at torproject.org
Thu Aug 14 11:34:05 UTC 2014


commit fd95a46128a3fb4779498df5e615b419d1750fd0
Author: Arturo Filastò <art at fuffa.org>
Date:   Thu Aug 14 12:59:52 2014 +0200

    Fix bug that lead to sniffer not being unregistered properly.
---
 ooni/director.py |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ooni/director.py b/ooni/director.py
index 43269cc..7496ba8 100644
--- a/ooni/director.py
+++ b/ooni/director.py
@@ -195,10 +195,11 @@ class Director(object):
         self.successfulMeasurements += 1
         measurement.result = result
         test_name = test_class_name_to_name(measurement.testInstance.name)
-        sniffer = self.sniffers[test_name]
-        config.scapyFactory.unRegisterProtocol(sniffer)
-        sniffer.close()
-        del self.sniffers[test_name]
+        if test_name in self.sniffers:
+            sniffer = self.sniffers[test_name]
+            config.scapyFactory.unRegisterProtocol(sniffer)
+            sniffer.close()
+            del self.sniffers[test_name]
         return measurement
 
     def measurementFailed(self, failure, measurement):





More information about the tor-commits mailing list