Add a patch from the grugq to allow binding to a specific interface in api.connect_tcp.

This commit is contained in:
donovan
2008-06-30 11:10:57 -07:00
parent 63410e9de2
commit f6ae4e494e
2 changed files with 5 additions and 2 deletions

View File

@@ -102,12 +102,15 @@ def ssl_listener(address, certificate, private_key):
socket.is_secure = True socket.is_secure = True
return socket return socket
def connect_tcp(address): def connect_tcp(address, localaddr=None):
""" """
Create a TCP connection to address (host, port) and return the socket. Create a TCP connection to address (host, port) and return the socket.
Optionally, bind to localaddr (host, port) first.
""" """
from eventlet import greenio, util from eventlet import greenio, util
desc = greenio.GreenSocket(util.tcp_socket()) desc = greenio.GreenSocket(util.tcp_socket())
if localaddr is not None:
desc.bind(localaddr)
desc.connect(address) desc.connect(address)
return desc return desc

View File

@@ -6,7 +6,7 @@ from setuptools import find_packages, setup
setup( setup(
name='eventlet', name='eventlet',
version='0.6', version='0.7pre',
description='Coroutine-based networking library', description='Coroutine-based networking library',
author='Linden Lab', author='Linden Lab',
author_email='eventletdev@lists.secondlife.com', author_email='eventletdev@lists.secondlife.com',