From 4bb9f3d35b02bb076dd8df133288492c24295c8a Mon Sep 17 00:00:00 2001 From: Sandor Nemes Date: Fri, 8 Jan 2016 18:04:47 +0100 Subject: [PATCH 1/2] Added getter/setter for TCPClient source_address --- netlib/tcp.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/netlib/tcp.py b/netlib/tcp.py index 8e46d4f6e..e5e9ec1a3 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -565,6 +565,17 @@ class TCPClient(_Connection): else: self.__address = None + @property + def source_address(self): + return self.__source_address + + @source_address.setter + def source_address(self, source_address): + if source_address: + self.__source_address = Address.wrap(source_address) + else: + self.__source_address = None + def close(self): # Make sure to close the real socket, not the SSL proxy. # OpenSSL is really good at screwing up, i.e. when trying to recv from a failed connection, From b8e8c4d68222c9292daf23e6ace55351fcef1af6 Mon Sep 17 00:00:00 2001 From: Sandor Nemes Date: Mon, 11 Jan 2016 08:10:36 +0100 Subject: [PATCH 2/2] Simplified setting the source_address in the TCPClient constructor --- netlib/tcp.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/netlib/tcp.py b/netlib/tcp.py index e5e9ec1a3..8902b9dca 100644 --- a/netlib/tcp.py +++ b/netlib/tcp.py @@ -548,8 +548,7 @@ class TCPClient(_Connection): def __init__(self, address, source_address=None): super(TCPClient, self).__init__(None) self.address = address - self.source_address = Address.wrap( - source_address) if source_address else None + self.source_address = source_address self.cert = None self.ssl_verification_error = None self.sni = None