diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-08-18 15:59:44 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-08-18 15:59:44 +0200 |
commit | ab1549e0eff98588211346aada44549311f04938 (patch) | |
tree | d5fa78c1d639d5f63f60b637821496c05ec1da18 /libmproxy/protocol2/socks_proxy.py | |
parent | 96de7ad562da9b5110059988b851c66b51874510 (diff) | |
download | mitmproxy-ab1549e0eff98588211346aada44549311f04938.tar.gz mitmproxy-ab1549e0eff98588211346aada44549311f04938.tar.bz2 mitmproxy-ab1549e0eff98588211346aada44549311f04938.zip |
yield -> callbacks
Diffstat (limited to 'libmproxy/protocol2/socks_proxy.py')
-rw-r--r-- | libmproxy/protocol2/socks_proxy.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libmproxy/protocol2/socks_proxy.py b/libmproxy/protocol2/socks_proxy.py index 5bb8e5f8..18b363d5 100644 --- a/libmproxy/protocol2/socks_proxy.py +++ b/libmproxy/protocol2/socks_proxy.py @@ -5,7 +5,7 @@ from ..proxy import ProxyError, Socks5ProxyMode from .layer import Layer, ServerConnectionMixin -class Socks5Proxy(ServerConnectionMixin, Layer): +class Socks5Proxy(Layer, ServerConnectionMixin): def __call__(self): try: s5mode = Socks5ProxyMode(self.config.ssl_ports) @@ -16,9 +16,12 @@ class Socks5Proxy(ServerConnectionMixin, Layer): self.server_conn.address = address + # TODO: Kill event + layer = self.ctx.next_layer(self) - for message in layer(): - if not self._handle_server_message(message): - yield message - if self.server_conn: - self._disconnect()
\ No newline at end of file + + try: + layer() + finally: + if self.server_conn: + self._disconnect()
\ No newline at end of file |