[Pkg-privacy-commits] [obfsproxy] 82/353: Resolve some XXXs.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:01:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository obfsproxy.

commit a03c344676a907414626f517fccf937aabd0c5fa
Author: George Kadianakis <desnacked at riseup.net>
Date:   Fri Nov 2 04:56:58 2012 +0200

    Resolve some XXXs.
---
 obfsproxy.py                 |  5 ++---
 obfsproxy/common/aes.py      |  2 +-
 obfsproxy/network/network.py | 43 ++++++++++++++++++-------------------------
 3 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/obfsproxy.py b/obfsproxy.py
index bc72e1e..f3af07f 100755
--- a/obfsproxy.py
+++ b/obfsproxy.py
@@ -51,15 +51,14 @@ def set_up_cli_parsing():
     arguments."""
     for transport, transport_class in transports.transports.items():
         subparser = subparsers.add_parser(transport, help='%s help' % transport)
-        transport_class['client'].register_external_mode_cli(subparser) # XXX
+        transport_class['client'].register_external_mode_cli(subparser)
         subparser.set_defaults(validation_function=transport_class['client'].validate_external_mode_cli)
 
     return parser
 
-def do_managed_mode(): # XXX bad code
+def do_managed_mode():
     """This function starts obfsproxy's managed-mode functionality."""
 
-    # XXX original code caught exceptions here!!!
     if checkClientMode():
         log.info('Entering client managed-mode.')
         managed_client.do_managed_client()
diff --git a/obfsproxy/common/aes.py b/obfsproxy/common/aes.py
index 43e0e4a..3f29346 100644
--- a/obfsproxy/common/aes.py
+++ b/obfsproxy/common/aes.py
@@ -15,7 +15,7 @@ class AES_CTR_128(object):
         assert(len(key) == 16)
         assert(len(iv) == 16)
 
-        self.ctr = Counter.new(128, initial_value=long(iv.encode('hex'), 16)) # XXX hex???
+        self.ctr = Counter.new(128, initial_value=long(iv.encode('hex'), 16))
         self.cipher = AES.new(key, AES.MODE_CTR, counter=self.ctr)
 
     def crypt(self, data):
diff --git a/obfsproxy/network/network.py b/obfsproxy/network/network.py
index 4d21e32..9a8a9e9 100644
--- a/obfsproxy/network/network.py
+++ b/obfsproxy/network/network.py
@@ -1,4 +1,3 @@
-# XXX fix imports
 from twisted.python import failure
 from twisted.internet import reactor, error, address, tcp
 from twisted.internet.protocol import Protocol, Factory, ClientFactory
@@ -84,7 +83,7 @@ class Circuit(Protocol):
 
         self.name = "circ_%s" % hex(id(self))
 
-    def setDownstreamConnection(self, conn): # XXX merge set{Downstream,Upstream}Connection.
+    def setDownstreamConnection(self, conn):
         """
         Set the downstream connection of a circuit.
         """
@@ -93,17 +92,7 @@ class Circuit(Protocol):
         assert(not self.downstream)
         self.downstream = conn
 
-        """We just completed the circuit.
-
-        Do a dummy dataReceived on the initiating connection in case
-        it has any buffered data that must be flushed to the network.
-
-        Also, call the transport-specific handshake method since this
-        is a good time to perform a handshake.
-        """
-        if self.circuitIsReady():
-            self.upstream.dataReceived('') # XXX kind of a hack.
-            self.transport.handshake(self)
+        if self.circuitIsReady(): self.circuitCompleted(self.upstream)
 
     def setUpstreamConnection(self, conn):
         """
@@ -114,17 +103,7 @@ class Circuit(Protocol):
         assert(not self.upstream)
         self.upstream = conn
 
-        """We just completed the circuit.
-
-        Do a dummy dataReceived on the initiating connection in case
-        it has any buffered data that must be flushed to the network.
-
-        Also, call the transport-specific handshake method since this
-        is a good time to perform a handshake.
-        """
-        if self.circuitIsReady():
-            self.downstream.dataReceived('')
-            self.transport.handshake(self)
+        if self.circuitIsReady(): self.circuitCompleted(self.downstream)
 
     def circuitIsReady(self):
         """
@@ -133,6 +112,20 @@ class Circuit(Protocol):
 
         return self.downstream and self.upstream
 
+    def circuitCompleted(self, conn_to_flush):
+        """
+        Circuit was just completed; that is, its endpoints are now
+        connected. Do all the things we have to do now.
+        """
+
+        # Do a dummy dataReceived on the initiating connection in case
+        # it has any buffered data that must be flushed to the network.
+        conn_to_flush.dataReceived('') # XXX hack way to flush
+
+        # Call the transport-specific handshake method since this is a
+        # good time to perform a handshake.
+        self.transport.handshake(self)
+
     def dataReceived(self, data, conn):
         """
         We received 'data' on 'conn'. Pass the data to our transport,
@@ -187,7 +180,7 @@ class StaticDestinationProtocol(Protocol):
         self.mode = mode
         self.circuit = circuit
         self.buffer = buffer.Buffer()
-        self.peer_addr = peer_addr # XXX unused
+        self.peer_addr = peer_addr
 
         self.closed = False # True if connection is closed.
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfsproxy.git



More information about the Pkg-privacy-commits mailing list