[Pkg-privacy-commits] [obfsproxy] 92/353: Use network.GenericProtocol in some more places.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:01:44 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 eab3f27defd536b80268806ee167de64086714de
Author: George Kadianakis <desnacked at riseup.net>
Date: Thu Nov 29 18:36:21 2012 +0200
Use network.GenericProtocol in some more places.
---
obfsproxy/network/network.py | 2 +-
obfsproxy/network/socks.py | 19 ++++---------------
2 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/obfsproxy/network/network.py b/obfsproxy/network/network.py
index 812ec2d..4cb95ca 100644
--- a/obfsproxy/network/network.py
+++ b/obfsproxy/network/network.py
@@ -165,7 +165,7 @@ class Circuit(Protocol):
self.transport.circuitDestroyed(self, reason, side)
-class GenericProtocol(Protocol):
+class GenericProtocol(Protocol, object):
"""
Generic obfsproxy connection. Contains useful methods and attributes.
diff --git a/obfsproxy/network/socks.py b/obfsproxy/network/socks.py
index 22c088b..903de5a 100644
--- a/obfsproxy/network/socks.py
+++ b/obfsproxy/network/socks.py
@@ -7,7 +7,7 @@ import obfsproxy.network.buffer as buffer
log = logging.get_obfslogger()
-class MySOCKSv4Outgoing(socks.SOCKSv4Outgoing, object):
+class MySOCKSv4Outgoing(socks.SOCKSv4Outgoing, network.GenericProtocol):
"""
Represents a downstream connection from the SOCKS server to the
destination.
@@ -30,13 +30,9 @@ class MySOCKSv4Outgoing(socks.SOCKSv4Outgoing, object):
'socksProtocol' is a 'SOCKSv4Protocol' object.
"""
-
- self.circuit = socksProtocol.circuit
- self.buffer = buffer.Buffer()
- self.closed = False # True if connection is closed.
-
self.name = "socks_down_%s" % hex(id(self))
+ network.GenericProtocol.__init__(self, socksProtocol.circuit)
return super(MySOCKSv4Outgoing, self).__init__(socksProtocol)
def dataReceived(self, data):
@@ -60,10 +56,7 @@ class MySOCKSv4Outgoing(socks.SOCKSv4Outgoing, object):
self.closed = True
def connectionLost(self, reason):
- # The circuit is handling this event.
- log.debug("%s: SOCKS downstream to remote is closing (%s)." % \
- (self.name, reason.getErrorMessage()))
- self.circuit.close(reason, 'downstream')
+ network.GenericProtocol.connectionLost(self, reason)
# Monkey patches socks.SOCKSv4Outgoing with our own class.
socks.SOCKSv4Outgoing = MySOCKSv4Outgoing
@@ -114,11 +107,7 @@ class SOCKSv4Protocol(socks.SOCKSv4, network.GenericProtocol):
self.circuit.dataReceived(self.buffer, self)
def connectionLost(self, reason):
- # The circuit is handling this event.
- log.debug("%s: SOCKS upstream to local is closing (%s)." % \
- (self.name, reason.getErrorMessage()))
- self.circuit.close(reason, 'upstream')
-
+ network.GenericProtocol.connectionLost(self, reason)
class SOCKSv4Factory(Factory):
"""
--
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