%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib64/python2.7/site-packages/tornado/
Upload File :
Create Path :
Current File : //usr/lib64/python2.7/site-packages/tornado/tcpclient.pyo

�
��L]c@�s�dZddlmZmZmZmZddlZddlZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZd	Zd
efd��YZdefd
��YZdS(s'A non-blocking TCP connection factory.
i(tabsolute_importtdivisiontprint_functiontwith_statementN(tFuture(tIOLoop(tIOStream(tgen(tResolverg333333�?t
_ConnectorcB�s_eZdZd�Zed��Zed�Zd�Zd�Z	d�Z
d�Zd�ZRS(	s�A stateless implementation of the "Happy Eyeballs" algorithm.

    "Happy Eyeballs" is documented in RFC6555 as the recommended practice
    for when both IPv4 and IPv6 addresses are available.

    In this implementation, we partition the addresses by family, and
    make the first connection attempt to whichever address was
    returned first by ``getaddrinfo``.  If that connection fails or
    times out, we begin a connection in parallel to the first address
    of the other family.  If there are additional failures we retry
    with other addresses, keeping one connection attempt per family
    in flight at a time.

    http://tools.ietf.org/html/rfc6555

    cC�s^||_||_t�|_d|_d|_t|�|_|j	|�\|_
|_dS(N(tio_looptconnectRtfuturetNonettimeoutt
last_errortlent	remainingtsplitt
primary_addrstsecondary_addrs(tselftaddrinfoR
R((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyt__init__1s				cC�spg}g}|dd}xI|D]A\}}||krO|j||f�q!|j||f�q!W||fS(s�Partition the ``addrinfo`` list by address family.

        Returns two lists.  The first list contains the first entry from
        ``addrinfo`` and all others with the same family, and the
        second list contains all other addresses (normally one list will
        be AF_INET and the other AF_INET6, although non-standard resolvers
        may return additional families).
        i(tappend(Rtprimaryt	secondaryt
primary_aftaftaddr((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyR;s
cC�s*|jt|j��|j|�|jS(N(ttry_connecttiterRt
set_timoutR(RR((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pytstartOs
cC�s�yt|�\}}WnStk
rk|jdkrg|jj�rg|jj|jp`td��ndSX|j||�}|j	t
j|j|||��dS(Nisconnection failed(
tnextt
StopIterationRRtdonet
set_exceptionRtIOErrorRtadd_done_callbackt	functoolstpartialton_connect_done(RtaddrsRRR((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyRTs
cC�s�|jd8_y|j�}Wnltk
r�}|jj�rDdS||_|j|�|jdk	r�|j	j
|j�|j�ndSX|j�|jj�r�|j
�n|jj|||f�dS(Ni(Rtresultt	ExceptionRR$RRRR
R
tremove_timeoutt
on_timeoutt
clear_timeouttcloset
set_result(RR+RRRtstreamte((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyR*cs 	



cC�s,|jj|jj�||j�|_dS(N(R
tadd_timeoutttimeR/R(RR((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyR {scC�s#d|_|jt|j��dS(N(R
RRRR(R((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyR/s	cC�s)|jdk	r%|jj|j�ndS(N(RR
R
R.(R((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyR0�s(
t__name__t
__module__t__doc__RtstaticmethodRt_INITIAL_CONNECT_TIMEOUTR!RR*R R/R0(((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyR	 s	
				t	TCPClientcB�sMeZdZddd�Zd�Zejej	ddd��Z
d�ZRS(swA non-blocking TCP connection factory.

    .. versionchanged:: 4.1
       The ``io_loop`` argument is deprecated.
    cC�sU|ptj�|_|dk	r6||_t|_ntd|�|_t|_dS(NR
(	RtcurrentR
R
tresolvertFalset
_own_resolverRtTrue(RR>R
((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyR�s	cC�s|jr|jj�ndS(N(R@R>R1(R((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyR1�s	c
c�s�|jj|||�V}t||jtj|j|��}|j�V\}}}	|dk	r~|	j	t
d|d|�V}	ntj|	��dS(s�Connect to the given host and port.

        Asynchronously returns an `.IOStream` (or `.SSLIOStream` if
        ``ssl_options`` is not None).
        tssl_optionstserver_hostnameN(
R>tresolveR	R
R(R)t_create_streamR!R
t	start_tlsR?RtReturn(
RthosttportRRBtmax_buffer_sizeRt	connectorRR3((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyR�s	
cC�s1ttj|�d|jd|�}|j|�S(NR
RJ(RtsocketR
R(RRJRRR3((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyRE�s		N(R7R8R9R
RR1Rt	coroutineRLt	AF_UNSPECRRE(((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyR<�s			(R9t
__future__RRRRR(RLttornado.concurrentRttornado.ioloopRttornado.iostreamRttornadoRttornado.netutilRR;tobjectR	R<(((s7/usr/lib64/python2.7/site-packages/tornado/tcpclient.pyt<module>s"h

Zerion Mini Shell 1.0