3
Z_ð]~  ã               @   sª   d dl Z d dlZedƒ ejd ZejZejdddddg Zd dlmZ eee	ƒ e
eƒd	� e jjd
dƒjƒ dkr˜d dlmZ ejZejZejZejZ[edfdd„ZdS )é    Nzeventlet.green._socket_nodnsÚcreate_connectionÚgetaddrinfoÚgethostbynameÚgethostbyname_exÚgetnameinfo)Úslurp_properties)ZsrckeysZEVENTLET_NO_GREENDNSÚ Úyes)Úgreendnsc             C   sÂ   d}| \}}xšt ||dtƒD ]ˆ}|\}}}	}
}d}y:t|||	ƒ}|tk	rR|j|ƒ |r`|j|ƒ |j|ƒ |S  tk
r¢ } z|}|dk	r’|jƒ  W Y dd}~X qX qW t	|tƒsºt|ƒ}|‚dS )a›  Connect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,
    port)``) and return the socket object.  Passing the optional
    *timeout* parameter will set the timeout on the socket instance
    before attempting to connect.  If no *timeout* is supplied, the
    global default timeout setting returned by :func:`getdefaulttimeout`
    is used.
    z!getaddrinfo returns an empty listr   N)
r   ÚSOCK_STREAMÚsocketÚ_GLOBAL_DEFAULT_TIMEOUTÚ
settimeoutÚbindÚconnectÚerrorÚcloseÚ
isinstance)ÚaddressÚtimeoutÚsource_addressÚerrÚhostÚportÚresÚafÚsocktypeÚprotoÚ	canonnameÚsaÚsockÚe© r"   ú9/tmp/pip-build-yz_zf6az/eventlet/eventlet/green/socket.pyr      s(    



)ÚosÚsysÚ
__import__ÚmodulesZ__socketÚ__all__Z__patched__Zeventlet.patcherr   ÚglobalsÚdirÚenvironÚgetÚlowerZeventlet.supportr
   r   r   r   r   r   r   r"   r"   r"   r#   Ú<module>   s*   
