[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Refactorings



commit 53f207416383b7782639d0ee2177580ba23bc5e7
Author: Arun Pandian G <arunpandianp@xxxxxxxxx>
Date:   Tue Apr 8 04:12:03 2014 +0530

    Refactorings
---
 ooni/templates/httpt.py |   20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/ooni/templates/httpt.py b/ooni/templates/httpt.py
index 44d01be..1263261 100644
--- a/ooni/templates/httpt.py
+++ b/ooni/templates/httpt.py
@@ -1,10 +1,8 @@
 import random
 
-from zope.interface import implements
-
 from twisted.internet import defer
 
-from txtorcon.interface import IStreamListener
+from txtorcon.interface import StreamListenerMixin
 
 from twisted.internet import reactor
 from twisted.internet.endpoints import TCP4ClientEndpoint
@@ -22,33 +20,21 @@ from ooni.errors import handleAllFailures
 class InvalidSocksProxyOption(Exception):
     pass
 
-class StreamListener(object):
-    implements(IStreamListener)
+class StreamListener(StreamListenerMixin):
 
     def __init__(self, request):
         self.request = request
 
-    def stream_new(self, stream):
-            pass
-
     def stream_succeeded(self, stream):
         host=self.request['url'].split('/')[2]
         try:
             if stream.target_host == host and len(self.request['tor']) == 1:
                 self.request['tor']['exit_ip'] = stream.circuit.path[-1].ip
                 self.request['tor']['exit_name'] = stream.circuit.path[-1].name
+                config.tor_state.stream_listeners.remove(self)
         except:
             log.err("Tor Exit ip detection failed")
 
-    def stream_attach(self, stream, circuit):
-            pass
-
-    def stream_closed(self, stream,**k):
-            pass
-
-    def stream_failed(self, stream, reason, remote_reason):
-            pass
-
 class HTTPTest(NetTestCase):
     """
     A utility class for dealing with HTTP based testing. It provides methods to



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits