[tor-commits] [ooni-probe/master] * Make TCPScan use gevent sockets

art at torproject.org art at torproject.org
Wed Mar 21 03:33:15 UTC 2012


commit 79ef12a4ed5db353b8341b1977707dc6e9ae9d28
Author: Arturo Filastò <hellais at gmail.com>
Date:   Thu Mar 15 00:08:20 2012 -0700

    * Make TCPScan use gevent sockets
    * Make the log level be configurable from config file
---
 ooni-probe.conf  |    3 ++-
 plugoo/assets.py |    4 ----
 tests/tcpscan.py |    2 +-
 utils.py         |    2 +-
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/ooni-probe.conf b/ooni-probe.conf
index 9563493..8702353 100644
--- a/ooni-probe.conf
+++ b/ooni-probe.conf
@@ -9,10 +9,11 @@ assetdir = assets/
 testdir = tests/
 
 loglevel = DEBUG
+consoleloglevel = DEBUG
 proxyaddress = 127.0.0.1:9050
 
 # The following configurations are for searching for PlanetLab
-# nodes, adding them to a slice, and PlanetLab general API 
+# nodes, adding them to a slice, and PlanetLab general API
 # authentication:
 pl_username = yourusername
 pl_password = yourpassword
diff --git a/plugoo/assets.py b/plugoo/assets.py
index 5ed0399..eded997 100644
--- a/plugoo/assets.py
+++ b/plugoo/assets.py
@@ -41,13 +41,9 @@ class Asset:
         #     clean me up please...
         line = self.fh.readline()
         if line:
-<<<<<<< HEAD
             parsed_line = self.parse_line(line)
             if parsed_line:
                 return parsed_line
-=======
-            return self.parse_line(line)
->>>>>>> 74f25ec... Add a line by line parser
         else:
             self.fh.seek(0)
             raise StopIteration
diff --git a/tests/tcpscan.py b/tests/tcpscan.py
index 9e962ca..26e854b 100644
--- a/tests/tcpscan.py
+++ b/tests/tcpscan.py
@@ -6,7 +6,7 @@
 
 """
 import os
-import socket
+from gevent import socket
 from datetime import datetime
 import socks
 
diff --git a/utils.py b/utils.py
index 79edadb..e9c55f1 100644
--- a/utils.py
+++ b/utils.py
@@ -61,7 +61,7 @@ def get_logger(config):
                     filemode='w')
 
     console = logging.StreamHandler()
-    console.setLevel(logging.INFO)
+    console.setLevel(getattr(logging, config.consoleloglevel.upper()))
     # Set the console logger to a different format
     formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
     console.setFormatter(formatter)





More information about the tor-commits mailing list