ok

Mini Shell

Direktori : /opt/alt/python35/lib64/python3.5/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/asyncio/__pycache__/selector_events.cpython-35.pyc



B�Ma���
@s�dZdgZddlZddlZddlZddlZddlZddlZyddlZWne	k
r�dZYnXddl
mZddl
mZddl
m
Z
ddl
mZdd	l
mZdd
l
mZddl
mZddl
mZdd
lmZddlmZdd�Zeed�rLdd�Zndd�ZGdd�dej�ZGdd�dejej�ZGdd�de�ZGdd�de�Z Gdd�de�Z!dS)z�Event loop using a selector and related classes.

A selector is a "notify-when-ready" multiplexer.  For a subclass which
also includes support for signal handling, see the unix_events sub-module.
�BaseSelectorEventLoop�N�)�base_events)�compat)�	constants)�events)�futures)�	selectors)�
transports)�sslproto)�	coroutine)�loggercCsAy|j|�}Wntk
r+dSYnXt|j|@�SdS)NF)�get_key�KeyError�boolr)�selector�fdZevent�key�r�</opt/alt/python35/lib64/python3.5/asyncio/selector_events.py�_test_selector_event s

	r�TCP_NODELAYcCs\|jtjtjhkrX|jtjkrX|jtjkrX|jtjtj	d�dS)Nr)
�family�socketZAF_INETZAF_INET6�typeZSOCK_STREAM�protoZIPPROTO_TCPZ
setsockoptr)�sockrrr�_set_nodelay,srcCsdS)Nr)rrrrr2scsDeZdZdZd�fdd�Zddddddd�Zdd	d
dddddddd
�Zd	d
dddddddd�Zddddd�Z�fdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zddd d!d"�Zddd d#d$�Zeddd%d&��Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Zd?d@�Z edAdB��Z!dCdD�Z"dEdF�Z#dGdH�Z$dIdJ�Z%dKdL�Z&dMdN�Z'dOdP�Z(�S)QrzJSelector event loop.

    See events.EventLoop for API specification.
    Ncsat�j�|dkr%tj�}tjd|jj�||_|j	�t
j�|_dS)NzUsing selector: %s)
�super�__init__r	ZDefaultSelectorr
�debug�	__class__�__name__�	_selector�_make_self_pipe�weakref�WeakValueDictionary�_transports)�selfr)r!rrr<s
	
zBaseSelectorEventLoop.__init__�extra�servercCst||||||�S)N)�_SelectorSocketTransport)r(r�protocol�waiterr)r*rrr�_make_socket_transportFsz,BaseSelectorEventLoop._make_socket_transport�server_sideF�server_hostnamec

Cs{tj�s:|j||||d|d|d|d|�Stj||||||�}	t|||	d|d|�|	jS)Nr/r0r)r*)rZ_is_sslproto_available�_make_legacy_ssl_transportZSSLProtocolr+Z_app_transport)
r(�rawsockr,�
sslcontextr-r/r0r)r*Zssl_protocolrrr�_make_ssl_transportKs

z)BaseSelectorEventLoop._make_ssl_transportc	
Cs"t|||||||||�	S)N)�_SelectorSslTransport)	r(r2r,r3r-r/r0r)r*rrrr1Zsz0BaseSelectorEventLoop._make_legacy_ssl_transportcCst||||||�S)N)�_SelectorDatagramTransport)r(rr,�addressr-r)rrr�_make_datagram_transportdsz.BaseSelectorEventLoop._make_datagram_transportcsh|j�rtd��|j�r(dS|j�t�j�|jdk	rd|jj�d|_dS)Nz!Cannot close a running event loop)Z
is_running�RuntimeError�	is_closed�_close_self_piper�closer#)r()r!rrr<is


zBaseSelectorEventLoop.closecCs
t�dS)N)�NotImplementedError)r(rrr�_socketpairtsz!BaseSelectorEventLoop._socketpaircCsU|j|jj��|jj�d|_|jj�d|_|jd8_dS)Nr)�_remove_reader�_ssock�filenor<�_csock�
_internal_fds)r(rrrr;ws
	
	z&BaseSelectorEventLoop._close_self_pipecCsg|j�\|_|_|jjd�|jjd�|jd7_|j|jj�|j�dS)NFr)r>r@rB�setblockingrC�_add_readerrA�_read_from_self)r(rrrr$s
z%BaseSelectorEventLoop._make_self_pipecCsdS)Nr)r(�datarrr�_process_self_data�sz(BaseSelectorEventLoop._process_self_datacCs_xXy*|jjd�}|sP|j|�Wqtk
rDwYqtk
rVPYqXqWdS)Ni)r@�recvrH�InterruptedError�BlockingIOError)r(rGrrrrF�s

z%BaseSelectorEventLoop._read_from_selfcCs[|j}|dk	rWy|jd�Wn.tk
rV|jrRtjddd�YnXdS)Nsz3Fail to write a null byte into the self-pipe socket�exc_infoT)rB�send�OSError�_debugr
r )r(Zcsockrrr�_write_to_self�s	
	z$BaseSelectorEventLoop._write_to_self�dcCs,|j|j�|j|||||�dS)N)rErA�_accept_connection)r(�protocol_factoryrr3r*�backlogrrr�_start_serving�sz$BaseSelectorEventLoop._start_servingcCs[xTt|�D]F}yB|j�\}}|jrGtjd|||�|jd�Wn�tttfk
rvdSYq
t	k
r}	z�|	j
t
jt
jt
j
t
jfkr	|jddd|	d|i�|j|j��|jtj|j|||||�n�WYdd}	~	Xq
Xd|i}
|j|||
||�}|j|�q
WdS)Nz#%r got a new connection from %r: %rF�messagez&socket.accept() out of system resource�	exceptionr�peername)�range�acceptrOr
r rDrKrJ�ConnectionAbortedErrorrN�errnoZEMFILEZENFILEZENOBUFSZENOMEM�call_exception_handlerr?rAZ
call_laterrZACCEPT_RETRY_DELAYrU�_accept_connection2Zcreate_task)r(rSrr3r*rT�_�conn�addr�excr)rZrrrrR�s4		


z(BaseSelectorEventLoop._accept_connectionccs$d}d}y�|�}|j�}|rZ|j|||d|ddd|d|�}n$|j||d|d|d|�}y
|EdHWn|j��YnXWnytk
r}	zY|jr
ddd|	i}
|dk	r�||
d	<|dk	r||
d
<|j|
�WYdd}	~	XnXdS)Nr-r/Tr)r*rVz3Error on transport creation for incoming connectionrWr,�	transport)�
create_futurer4r.r<�	ExceptionrOr])r(rSr`r)r3r*r,rcr-rb�contextrrrr^�s4		

	

z)BaseSelectorEventLoop._accept_connection2cCsNy|j|}Wntk
r%Yn%X|j�sJtdj||���dS)Nz.File descriptor {!r} is used by transport {!r})r'r�
is_closingr9�format)r(rrcrrr�_ensure_fd_no_transport�s
z-BaseSelectorEventLoop._ensure_fd_no_transportc	
Gs�|j�tj|||�}y|jj|�}Wn1tk
rh|jj|tj|df�YnSX|j|j	}\}}|jj
||tjB||f�|dk	r�|j�dS)N)�
_check_closedr�Handler#rr�registerr	�
EVENT_READrG�modify�cancel)	r(r�callback�args�handler�mask�reader�writerrrrrEs


z!BaseSelectorEventLoop._add_readerc
Cs�|j�rdSy|jj|�}Wntk
r>dSYn{X|j|j}\}}|tjM}|s|jj|�n|jj	||d|f�|dk	r�|j
�dSdSdS)NFT)r:r#rrrrGr	rm�
unregisterrnro)r(rrrsrtrurrrr?s
	
z$BaseSelectorEventLoop._remove_readerc	
Gs�|j�tj|||�}y|jj|�}Wn1tk
rh|jj|tjd|f�YnSX|j|j	}\}}|jj
||tjB||f�|dk	r�|j�dS)N)rjrrkr#rrrlr	�EVENT_WRITErGrnro)	r(rrprqrrrrsrtrurrr�_add_writer(s


z!BaseSelectorEventLoop._add_writerc
Cs�|j�rdSy|jj|�}Wntk
r>dSYn{X|j|j}\}}|tjM}|s|jj|�n|jj	|||df�|dk	r�|j
�dSdSdS)zRemove a writer callback.FNT)r:r#rrrrGr	rwrvrnro)r(rrrsrtrurrr�_remove_writer7s
	
z$BaseSelectorEventLoop._remove_writercGs |j|�|j|||�S)zAdd a reader callback.)rirE)r(rrprqrrr�
add_readerNs
z BaseSelectorEventLoop.add_readercCs|j|�|j|�S)zRemove a reader callback.)rir?)r(rrrr�
remove_readerSs
z#BaseSelectorEventLoop.remove_readercGs |j|�|j|||�S)zAdd a writer callback..)rirx)r(rrprqrrr�
add_writerXs
z BaseSelectorEventLoop.add_writercCs|j|�|j|�S)zRemove a writer callback.)riry)r(rrrr�
remove_writer]s
z#BaseSelectorEventLoop.remove_writercCsM|jr'|j�dkr'td��|j�}|j|d||�|S)z�Receive data from the socket.

        The return value is a bytes object representing the data received.
        The maximum amount of data to be received at once is specified by
        nbytes.

        This method is a coroutine.
        rzthe socket must be non-blockingF)rO�
gettimeout�
ValueErrorrd�
_sock_recv)r(r�n�futrrr�	sock_recvbs
	zBaseSelectorEventLoop.sock_recvcCs�|j�}|r|j|�|j�r/dSy|j|�}Wnhttfk
r{|j||j|d||�Yn?tk
r�}z|j	|�WYdd}~XnX|j
|�dS)NT)rAr{�	cancelledrIrKrJrzr�re�
set_exception�
set_result)r(r��
registeredrr�rrGrbrrrr�qs
# z BaseSelectorEventLoop._sock_recvcCsc|jr'|j�dkr'td��|j�}|rR|j|d||�n
|jd�|S)a�Send data to the socket.

        The socket must be connected to a remote socket. This method continues
        to send data from data until either all data has been sent or an
        error occurs. None is returned on success. On error, an exception is
        raised, and there is no way to determine how much data, if any, was
        successfully processed by the receiving end of the connection.

        This method is a coroutine.
        rzthe socket must be non-blockingFN)rOr~rrd�
_sock_sendallr�)r(rrGr�rrr�sock_sendall�s
z"BaseSelectorEventLoop.sock_sendallcCs�|j�}|r|j|�|j�r/dSy|j|�}WnSttfk
rbd}Yn6tk
r�}z|j|�dSWYdd}~XnX|t|�kr�|j	d�n5|r�||d�}|j
||j|d||�dS)NrT)rAr}r�rMrKrJrer��lenr�r|r�)r(r�r�rrGrr�rbrrrr��s"


z#BaseSelectorEventLoop._sock_sendallccs�|jr'|j�dkr'td��ttd�sI|jtjkr�tj|d|jd|j	d|�}|j
�s�|EdH|j�d\}}}}}|j�}|j
|||�|EdHS)zTConnect to a remote socket at address.

        This method is a coroutine.
        rzthe socket must be non-blocking�AF_UNIXrr�loopN)rOr~r�hasattrrrr�rZ_ensure_resolvedr�done�resultrd�
_sock_connect)r(rr7Zresolvedr_r�rrr�sock_connect�s"!	z"BaseSelectorEventLoop.sock_connectcCs�|j�}y|j|�Wn�ttfk
ro|jtj|j|��|j||j	|||�Yn?t
k
r�}z|j|�WYdd}~XnX|jd�dS)N)
rAZconnectrKrJZadd_done_callback�	functools�partial�_sock_connect_doner|�_sock_connect_cbrer�r�)r(r�rr7rrbrrrr��s  z#BaseSelectorEventLoop._sock_connectcCs|j|�dS)N)r})r(rr�rrrr��sz(BaseSelectorEventLoop._sock_connect_donecCs�|j�rdSy>|jtjtj�}|dkrMt|d|f��WnIttfk
rhYn?tk
r�}z|j	|�WYdd}~XnX|j
d�dS)NrzConnect call failed %s)r�Z
getsockoptrZ
SOL_SOCKETZSO_ERRORrNrKrJrer�r�)r(r�rr7�errrbrrrr��s z&BaseSelectorEventLoop._sock_connect_cbcCsJ|jr'|j�dkr'td��|j�}|j|d|�|S)a|Accept a connection.

        The socket must be bound to an address and listening for connections.
        The return value is a pair (conn, address) where conn is a new socket
        object usable to send and receive data on the connection, and address
        is the address bound to the socket on the other end of the connection.

        This method is a coroutine.
        rzthe socket must be non-blockingF)rOr~rrd�_sock_accept)r(rr�rrr�sock_accept�s

z!BaseSelectorEventLoop.sock_acceptcCs�|j�}|r|j|�|j�r/dSy#|j�\}}|jd�Wnettfk
r�|j||j|d|�YnEt	k
r�}z|j
|�WYdd}~XnX|j||f�dS)NFT)rAr{r�rZrDrKrJrzr�rer�r�)r(r�r�rrr`r7rbrrrr��s
  z"BaseSelectorEventLoop._sock_acceptcCs�x�|D]�\}}|j|j}\}}|tj@rk|dk	rk|jr^|j|�n
|j|�|tj@r|dk	r|jr�|j|�q|j|�qWdS)N)	�fileobjrGr	rmZ
_cancelledr?Z
_add_callbackrwry)r(Z
event_listrrsr�rtrurrr�_process_events
s	
	z%BaseSelectorEventLoop._process_eventscCs!|j|j��|j�dS)N)r?rAr<)r(rrrr�
_stop_servingsz#BaseSelectorEventLoop._stop_serving))r"�
__module__�__qualname__�__doc__rr.r4r1r8r<r>r;r$rHrFrPrUrRrr^rirEr?rxryrzr{r|r}r�r�r�r�r�r�r�r�r�r�r�r�rr)r!rr6sV

(#cs�eZdZdZeZdZdd�fdd�Zdd�Zdd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
ejr�dd�Zddd�Zdd�Zdd�Zdd�Z�S)�_SelectorTransport�iNcst�j||�||jd<|j�|jd<d|jkr~y|j�|jd<Wn"tjk
r}d|jd<YnX||_|j�|_	||_
d|_||_|j
�|_d|_d|_|jdk	r�|jj�||j|j	<dS)NrZsocknamerXTrF)rr�_extraZgetsocknameZgetpeernamer�error�_sockrA�_sock_fd�	_protocol�_protocol_connected�_server�_buffer_factory�_buffer�
_conn_lost�_closingZ_attachr')r(r�rr,r)r*)r!rrr)s&
						
z_SelectorTransport.__init__cCs|jjg}|jdkr.|jd�n|jrD|jd�|jd|j�|jdk	r|jj�rt|jj	|jt
j�}|r�|jd�n
|jd�t|jj	|jt
j�}|r�d}nd}|j
�}|jd||f�d	d
j|�S)N�closed�closingzfd=%szread=pollingz	read=idle�pollingZidlezwrite=<%s, bufsize=%s>z<%s>� )r!r"r��appendr�r��_loopr:rr#r	rmrw�get_write_buffer_size�join)r(�infor��state�bufsizerrr�__repr__>s*	

	z_SelectorTransport.__repr__cCs|jd�dS)N)�_force_close)r(rrr�abortZsz_SelectorTransport.abortcCs
||_dS)N)r�)r(r,rrr�set_protocol]sz_SelectorTransport.set_protocolcCs|jS)N)r�)r(rrr�get_protocol`sz_SelectorTransport.get_protocolcCs|jS)N)r�)r(rrrrgcsz_SelectorTransport.is_closingcCsn|jr
dSd|_|jj|j�|jsj|jd7_|jj|j�|jj|jd�dS)NTr)	r�r�r?r�r�r�ry�	call_soon�_call_connection_lost)r(rrrr<fs			z_SelectorTransport.closecCs4|jdk	r0tjd|t�|jj�dS)Nzunclosed transport %r)r��warnings�warn�ResourceWarningr<)r(rrr�__del__tsz_SelectorTransport.__del__zFatal error on transportc	Csyt|tj�r=|jj�rhtjd||dd�n+|jjd|d|d|d|ji�|j	|�dS)Nz%r: %srLTrVrWrcr,)
�
isinstancerZ_FATAL_ERROR_IGNOREr��	get_debugr
r r]r�r�)r(rbrVrrr�_fatal_errorys	z_SelectorTransport._fatal_errorcCs�|jr
dS|jr6|jj�|jj|j�|js[d|_|jj|j�|jd7_|jj|j	|�dS)NTr)
r�r��clearr�ryr�r�r?r�r�)r(rbrrrr��s		
		z_SelectorTransport._force_closecCsuz|jr|jj|�Wd|jj�d|_d|_d|_|j}|dk	rp|j�d|_XdS)N)r�r�Zconnection_lostr�r<r�r�Z_detach)r(rbr*rrrr��s	
				
z(_SelectorTransport._call_connection_lostcCs
t|j�S)N)r�r�)r(rrrr��sz(_SelectorTransport.get_write_buffer_sizei)r"r�r��max_size�	bytearrayr�r�rr�r�r�r�rgr<rZPY34r�r�r�r�r�rr)r!rr�s 
	r�cseZdZddd�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
�S)r+Ncs�t�j|||||�d|_d|_t|j�|jj|jj	|�|jj|jj
|j|j�|dk	r�|jjt
j|d�dS)NF)rr�_eof�_pausedrr�r�r�r��connection_maderEr��_read_readyr�_set_result_unless_cancelled)r(r�rr,r-r)r*)r!rrr�s		
z!_SelectorSocketTransport.__init__cCsi|jrtd��|jr*td��d|_|jj|j�|jj�retjd|�dS)Nz#Cannot pause_reading() when closingzAlready pausedTz%r pauses reading)	r�r9r�r�r?r�r�r
r )r(rrr�
pause_reading�s			z&_SelectorSocketTransport.pause_readingcCsg|jstd��d|_|jr+dS|jj|j|j�|jj�rctj	d|�dS)Nz
Not pausedFz%r resumes reading)
r�r9r�r�rEr�r�r�r
r )r(rrr�resume_reading�s			z'_SelectorSocketTransport.resume_readingcCs�|jr
dSy|jj|j�}WnLttfk
r@Yn�tk
rt}z|j|d�WYdd}~XnnX|r�|jj	|�nT|j
j�r�tj
d|�|jj�}|r�|j
j|j�n
|j�dS)Nz$Fatal read error on socket transportz%r received EOF)r�r�rIr�rKrJrer�r��
data_receivedr�r�r
r �eof_receivedr?r�r<)r(rGrb�	keep_openrrrr��s 	#z$_SelectorSocketTransport._read_readycCsNt|tttf�s1tdt|�j��|jrFtd��|sPdS|j	r�|j	t
jkrxtj
d�|j	d7_	dS|js0y|jj|�}WnPttfk
r�YnStk
r�}z|j|d�dSWYdd}~XnX||d�}|sdS|jj|j|j�|jj|�|j�dS)Nz1data argument must be a bytes-like object, not %rz%Cannot call write() after write_eof()zsocket.send() raised exception.rz%Fatal write error on socket transport)r��bytesr��
memoryview�	TypeErrorrr"r�r9r�r�!LOG_THRESHOLD_FOR_CONNLOST_WRITESr
�warningr�r�rMrKrJrer�r�rxr��_write_ready�extend�_maybe_pause_protocol)r(rGr�rbrrr�write�s4		
	z_SelectorSocketTransport.writecCs|jstd��|jr"dSy|jj|j�}Wnlttfk
rUYn�tk
r�}z5|jj	|j
�|jj�|j|d�WYdd}~XnrX|r�|jd|�=|j
�|js|jj	|j
�|jr�|jd�n|jr|jjtj�dS)NzData should not be emptyz%Fatal write error on socket transport)r��AssertionErrorr�r�rMrKrJrer�ryr�r�r��_maybe_resume_protocolr�r�r��shutdownr�SHUT_WR)r(r�rbrrrr�
s(	
#
			z%_SelectorSocketTransport._write_readycCs6|jr
dSd|_|js2|jjtj�dS)NT)r�r�r�r�rr�)r(rrr�	write_eof"s
			z"_SelectorSocketTransport.write_eofcCsdS)NTr)r(rrr�
can_write_eof)sz&_SelectorSocketTransport.can_write_eof)r"r�r�rr�r�r�r�r�r�r�rr)r!rr+�s

#r+cs�eZdZeZddddd�fdd�Zddd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
�S)r5NFc

stdkrtd��|s0tj||�}d|ddi}
|rY|rY||
d<|j||
�}t�j|||||	�d|_||_||_	||_
d|_|jj
d|�|jj�r�tjd|�|jj�}nd}|j|�dS)Nzstdlib ssl module not availabler/Zdo_handshake_on_connectFr0r3z%r starts SSL handshake)�sslr9rZ_create_transport_contextZwrap_socketrrr��_server_hostname�_waiter�_sslcontextr�r��updater�r�r
r �time�
_on_handshake)
r(r�r2r,r3r-r/r0r)r*Zwrap_kwargsZsslsock�
start_time)r!rrr1s*

					z_SelectorSslTransport.__init__cCs^|jdkrdS|jj�sQ|dk	rA|jj|�n|jjd�d|_dS)N)r�r�r�r�)r(rbrrr�_wakeup_waiterUsz$_SelectorSslTransport._wakeup_waiterc%Cs�y|jj�Wntjk
rH|jj|j|j|�dSYn�tjk
r||jj	|j|j|�dSYn�t
k
r}z�|jj�r�tj
d|dd�|jj|j�|jj|j�|jj�|j|�t|t�rdS�WYdd}~XnX|jj|j�|jj|j�|jj�}t|jd�s|jr|jjtjkrytj||j�Wnhtk
r}zH|jj�r�tj
d|dd�|jj�|j|�dSWYdd}~XnX|jjd|d|jj�d|jj�d	|j�d
|_d
|_ |jj|j|j!�d|_"|jj#|j$j%|�|jj#|j�|jj�r�|jj&�|}tj'd||d�dS)
Nz%r: SSL handshake failedrLTZcheck_hostnamez1%r: SSL handshake failed on matching the hostname�peercert�cipher�compressionZ
ssl_objectFz%r: SSL handshake took %.1f msg@�@)(r�Zdo_handshaker��SSLWantReadErrorr�rEr�r��SSLWantWriteErrorrx�
BaseExceptionr�r
r�r?ryr<r�r�reZgetpeercertr�r�r�Zverify_modeZ	CERT_NONEZmatch_hostnamer�r�r�r��_read_wants_write�_write_wants_readr�r�r�r�r�r�r )r(r�rbr�Zdtrrrr�_sb

	


		



			z#_SelectorSslTransport._on_handshakecCsi|jrtd��|jr*td��d|_|jj|j�|jj�retjd|�dS)Nz#Cannot pause_reading() when closingzAlready pausedTz%r pauses reading)	r�r9r�r�r?r�r�r
r )r(rrrr��s			z#_SelectorSslTransport.pause_readingcCsg|jstd��d|_|jr+dS|jj|j|j�|jj�rctj	d|�dS)Nz
Not pausedFz%r resumes reading)
r�r9r�r�rEr�r�r�r
r )r(rrrr��s			z$_SelectorSslTransport.resume_readingcCsr|jr
dS|jrKd|_|j�|jrK|jj|j|j�y|jj|j	�}Wn�t
ttj
fk
r�Yn�tjk
r�d|_|jj|j�|jj|j|j�Yn�tk
r}z|j|d�WYdd}~XnmX|r|jj|�nSzE|jj�r=tjd|�|jj�}|r_tjd�Wd|j�XdS)NFTz!Fatal read error on SSL transportz%r received EOFz?returning true from eof_received() has no effect when using ssl)r�r�r�r�r�rxr�r�rIr�rKrJr�r�r�r�r?rer�r�r�r�r
r r�r�r<)r(rGrbr�rrrr��s4			
		#z!_SelectorSslTransport._read_readycCs�|jr
dS|jrTd|_|j�|jp8|jsT|jj|j|j�|jrAy|j	j
|j�}Wn�ttt
jfk
r�d}Yn�t
jk
r�d}|jj|j�d|_YnYtk
r*}z9|jj|j�|jj�|j|d�dSWYdd}~XnX|rA|jd|�=|j�|js}|jj|j�|jr}|jd�dS)NFrTz"Fatal write error on SSL transport)r�r�r�r�r�r�rEr�r�r�rMrKrJr�r�r�ryr�rer�r�r�r�)r(r�rbrrrr��s8			
	



		z"_SelectorSslTransport._write_readycCs�t|tttf�s1tdt|�j��|s;dS|jrv|jtj	krct
jd�|jd7_dS|js�|j
j|j|j�|jj|�|j�dS)Nz1data argument must be a bytes-like object, not %rzsocket.send() raised exception.r)r�r�r�r�r�rr"r�rr�r
r�r�r�rxr�r�r�r�)r(rGrrrr��s	
	z_SelectorSslTransport.writecCsdS)NFr)r(rrrr�sz#_SelectorSslTransport.can_write_eof)r"r�r�r�r�rr�r�r�r�r�r�r�r�rr)r!rr5-s"
?
"#r5csgeZdZejZddd�fdd�Zdd�Zdd�Zddd	�Z	d
d�Z
�S)r6Ncs�t�j||||�||_|jj|jj|�|jj|jj|j|j	�|dk	r�|jjt
j|d�dS)N)rr�_addressr�r�r�r�rEr�r�rr�)r(r�rr,r7r-r))r!rrrs	z#_SelectorDatagramTransport.__init__cCstdd�|jD��S)Ncss!|]\}}t|�VqdS)N)r�)�.0rGr_rrr�	<genexpr>'szC_SelectorDatagramTransport.get_write_buffer_size.<locals>.<genexpr>)�sumr�)r(rrrr�&sz0_SelectorDatagramTransport.get_write_buffer_sizecCs�|jr
dSy|jj|j�\}}Wn�ttfk
rFYn|tk
rz}z|jj|�WYdd}~XnHt	k
r�}z|j
|d�WYdd}~XnX|jj||�dS)Nz&Fatal read error on datagram transport)r�r�Zrecvfromr�rKrJrNr��error_receivedrer�Zdatagram_received)r(rGrarbrrrr�)s	"#z&_SelectorDatagramTransport._read_readycCs�t|tttf�s1tdt|�j��|s;dS|jro|d|jfkrotd|jf��|j	r�|jr�|j	t
jkr�tj
d�|j	d7_	dS|js�y7|jr�|jj|�n|jj||�dSWn�ttfk
r&|jj|j|j�Ynqtk
r^}z|jj|�dSWYdd}~Xn9tk
r�}z|j|d�dSWYdd}~XnX|jjt|�|f�|j�dS)Nz1data argument must be a bytes-like object, not %rz#Invalid address: must be None or %szsocket.send() raised exception.rz'Fatal write error on datagram transport)r�r�r�r�r�rr"r�rr�rr�r
r�r�r�rM�sendtorKrJr�rxr��
_sendto_readyrNr�r�rer�r�r�)r(rGrarbrrrr�7s<
			z!_SelectorDatagramTransport.sendtocCs:x�|jr�|jj�\}}y3|jr@|jj|�n|jj||�Wqttfk
r�|jj||f�PYqt	k
r�}z|j
j|�dSWYdd}~Xqtk
r�}z|j
|d�dSWYdd}~XqXqW|j�|js6|jj|j�|jr6|jd�dS)Nz'Fatal write error on datagram transport)r��popleftr�r�rMr�rKrJ�
appendleftrNr�r�rer�r�r�ryr�r�r�)r(rGrarbrrrr�^s*		
		z(_SelectorDatagramTransport._sendto_ready)r"r�r��collections�dequer�rr�r�r�r�rr)r!rr6s	'r6)"r��__all__r�r\r�rr�r%r��ImportError�rrrrrr	r
rZ
coroutinesr�logr
rr�rZ
BaseEventLooprZ_FlowControlMixinZ	Transportr�r+r5r6rrrr�<module>s@	
�����

Zerion Mini Shell 1.0