From 408d12dc416cd49de61ba25f4e61f8006d864f20 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 5 Dec 2011 08:26:00 +0000 Subject: [PATCH] minor fix --- extra/socks/socks.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/extra/socks/socks.py b/extra/socks/socks.py index 1c38d8ef4..642c313fe 100644 --- a/extra/socks/socks.py +++ b/extra/socks/socks.py @@ -396,7 +396,6 @@ def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, Patched for DNS-leakage """ host, port = address - err = None sock = None try: sock = socksocket(socket.AF_INET, socket.SOCK_STREAM) @@ -405,12 +404,8 @@ def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, if source_address: sock.bind(source_address) sock.connect(address) - return sock - - except error as _: - err = _ + except socket.error: if sock is not None: sock.close() - - if err is not None: - raise err + raise + return sock