On 01/25/2015 02:34 PM, Michał Górny wrote:
> diff --git a/bin/socks5-server.py b/bin/socks5-server.py
> new file mode 100644
> index 0000000..45cf76b
> --- /dev/null
> +++ b/bin/socks5-server.py
> @@ -0,0 +1,233 @@
> +#!/usr/bin/env python
> +# SOCKSv5 proxy server for network-sandbox
> +# Copyright 2015 Gentoo Foundation
> +# Distributed under the terms of the GNU General Public License v2
> +
> +import asyncore
> +import errno
> +import os
> +import socket
> +import struct
> +import sys
> +
> +
> +if sys.hexversion < 0x03000000:
> +     from io import BlockingIOError
> +
> +
> +class ProxyConnection(asyncore.dispatcher_with_send):
> +     _addr = None
> +     _connected = False
> +     _family = socket.AF_INET
> +     _proxy_conn = None

You've defined these as class variables, but they should be instance
variables (initialized in the constructor). Since the class is a
singleton, it works either way, but it's poor style to use class
variables like this.

> +class ProxyHandler(asyncore.dispatcher_with_send):
> +     _my_buf = b''
> +     _my_conn = None
> +     _my_state = 0
> +     _my_addr = None

These class variables should also be changed to instance variables.
-- 
Thanks,
Zac

Reply via email to