aboutsummaryrefslogtreecommitdiffstats
path: root/netlib
diff options
context:
space:
mode:
Diffstat (limited to 'netlib')
-rw-r--r--netlib/tcp.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py
index 5ecfca9d..ede8682b 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -319,6 +319,8 @@ class TCPClient(_Connection):
if self.source_address:
connection.bind(self.source_address())
connection.connect(self.address())
+ if not self.source_address:
+ self.source_address = Address(connection.getsockname())
self.rfile = Reader(connection.makefile('rb', self.rbufsize))
self.wfile = Writer(connection.makefile('wb', self.wbufsize))
except (socket.error, IOError), err: