AlkantarClanX12

Your IP : 3.137.190.6


Current Path : /opt/alt/python37/lib64/python3.7/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/asyncio/__pycache__/selector_events.cpython-37.opt-1.pyc

B

� f$��@s"dZdZddlZddlZddlZddlZddlZddlZddlZyddl	Z	Wne
k
rddZ	YnXddlmZddlm
Z
ddlmZddlmZdd	lmZdd
lmZddlmZddlmZd
d�Zdd�ZGdd�dej�ZGdd�dejej�ZGdd�de�ZGdd�de�ZdS)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)�	constants)�events)�futures)�	protocols)�sslproto)�
transports)�loggercCs6y|�|�}Wntk
r"dSXt|j|@�SdS)NF)�get_key�KeyError�boolr)�selector�fdZevent�key�r�</opt/alt/python37/lib64/python3.7/asyncio/selector_events.py�_test_selector_events
rcCs tdk	rt|tj�rtd��dS)Nz"Socket cannot be of type SSLSocket)�ssl�
isinstanceZ	SSLSocket�	TypeError)�sockrrr�_check_ssl_socket*srcs�eZdZdZdQ�fdd�	ZdRddd�dd�ZdSddddejd	�d
d�ZdTdd
�Z	�fdd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdddejfdd�Zdddejfdd�Zddejfdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*�Z+S)UrzJSelector event loop.

    See events.EventLoop for API specification.
    NcsFt���|dkrt��}t�d|jj�||_|�	�t
��|_dS)NzUsing selector: %s)
�super�__init__�	selectorsZDefaultSelectorr�debug�	__class__�__name__�	_selector�_make_self_pipe�weakrefZWeakValueDictionary�_transports)�selfr)rrrr5s
zBaseSelectorEventLoop.__init__)�extra�servercCst||||||�S)N)�_SelectorSocketTransport)r$r�protocol�waiterr%r&rrr�_make_socket_transport?s
z,BaseSelectorEventLoop._make_socket_transportF)�server_side�server_hostnamer%r&�ssl_handshake_timeoutc	Cs0tj|||||||	d�}
t|||
||d�|
jS)N)r-)r%r&)r	ZSSLProtocolr'Z_app_transport)r$Zrawsockr(�
sslcontextr)r+r,r%r&r-Zssl_protocolrrr�_make_ssl_transportDs
z)BaseSelectorEventLoop._make_ssl_transportcCst||||||�S)N)�_SelectorDatagramTransport)r$rr(�addressr)r%rrr�_make_datagram_transportQsz.BaseSelectorEventLoop._make_datagram_transportcsL|��rtd��|��rdS|��t���|jdk	rH|j��d|_dS)Nz!Cannot close a running event loop)Z
is_running�RuntimeError�	is_closed�_close_self_piper�closer )r$)rrrr6Vs


zBaseSelectorEventLoop.closecCsB|�|j���|j��d|_|j��d|_|jd8_dS)Nr)�_remove_reader�_ssock�filenor6�_csock�
_internal_fds)r$rrrr5as

z&BaseSelectorEventLoop._close_self_pipecCsNt��\|_|_|j�d�|j�d�|jd7_|�|j��|j�dS)NFr)	�socketZ
socketpairr8r:�setblockingr;�_add_readerr9�_read_from_self)r$rrrr!is
z%BaseSelectorEventLoop._make_self_pipecCsdS)Nr)r$�datarrr�_process_self_dataqsz(BaseSelectorEventLoop._process_self_datacCsVxPy |j�d�}|sP|�|�Wqtk
r8wYqtk
rLPYqXqWdS)Ni)r8�recvrA�InterruptedError�BlockingIOError)r$r@rrrr?tsz%BaseSelectorEventLoop._read_from_selfcCsJ|j}|dk	rFy|�d�Wn(tk
rD|jr@tjddd�YnXdS)N�z3Fail to write a null byte into the self-pipe socketT)�exc_info)r:�send�OSError�_debugrr)r$Zcsockrrr�_write_to_self�sz$BaseSelectorEventLoop._write_to_self�dc
Cs"|�|��|j||||||�dS)N)r>r9�_accept_connection)r$�protocol_factoryrr.r&�backlogr-rrr�_start_serving�s
z$BaseSelectorEventLoop._start_servingc
Cs�x�t|�D]�}y0|��\}}	|jr4t�d||	|�|�d�Wn�tttfk
rZdSt	k
r�}
z^|
j
t
jt
jt
j
t
jfkr�|�d|
|d��|�|���|�tj|j||||||�n�Wdd}
~
XYqXd|	i}|�||||||�}|�|�qWdS)Nz#%r got a new connection from %r: %rFz&socket.accept() out of system resource)�message�	exceptionr<�peername)�range�acceptrIrrr=rDrC�ConnectionAbortedErrorrH�errnoZEMFILEZENFILEZENOBUFSZENOMEM�call_exception_handlerr7r9Z
call_laterrZACCEPT_RETRY_DELAYrO�_accept_connection2Zcreate_task)
r$rMrr.r&rNr-�_�conn�addr�excr%rTrrrrL�s6



z(BaseSelectorEventLoop._accept_connectionc
�s�d}d}yl|�}|��}	|r8|j||||	d|||d�}n|j|||	||d�}y|	IdHWn|���YnXWn\tk
r�}
z>|jr�d|
d�}|dk	r�||d<|dk	r�||d<|�|�Wdd}
~
XYnXdS)NT)r)r+r%r&r-)r)r%r&z3Error on transport creation for incoming connection)rPrQr(�	transport)�
create_futurer/r*r6�	ExceptionrIrW)r$rMrZr%r.r&r-r(r]r)r\�contextrrrrX�s6
z)BaseSelectorEventLoop._accept_connection2c
Cs�|}t|t�sJyt|���}Wn*tttfk
rHtd|���d�YnXy|j|}Wntk
rlYnX|��s�t	d|�d|����dS)NzInvalid file object: zFile descriptor z is used by transport )
r�intr9�AttributeErrorr�
ValueErrorr#r
�
is_closingr3)r$rr9r]rrr�_ensure_fd_no_transport�s
z-BaseSelectorEventLoop._ensure_fd_no_transportc		Gs�|��t�|||d�}y|j�|�}Wn*tk
rR|j�|tj|df�Yn>X|j|j	}\}}|j�
||tjB||f�|dk	r�|��dS)N)�
_check_closedr�Handler rr
�registerr�
EVENT_READr@�modify�cancel)	r$r�callback�args�handler�mask�reader�writerrrrr>�s
z!BaseSelectorEventLoop._add_readercCs�|��rdSy|j�|�}Wntk
r0dSX|j|j}\}}|tjM}|sb|j�|�n|j�	||d|f�|dk	r�|�
�dSdSdS)NFT)r4r rr
rr@rri�
unregisterrjrk)r$rrrorprqrrrr7sz$BaseSelectorEventLoop._remove_readerc		Gs�|��t�|||d�}y|j�|�}Wn*tk
rR|j�|tjd|f�Yn>X|j|j	}\}}|j�
||tjB||f�|dk	r�|��dS)N)rfrrgr rr
rhr�EVENT_WRITEr@rjrk)	r$rrlrmrnrrorprqrrr�_add_writer s
z!BaseSelectorEventLoop._add_writercCs�|��rdSy|j�|�}Wntk
r0dSX|j|j}\}}|tjM}|sb|j�|�n|j�	|||df�|dk	r�|�
�dSdSdS)zRemove a writer callback.FNT)r4r rr
rr@rrsrrrjrk)r$rrrorprqrrr�_remove_writer/sz$BaseSelectorEventLoop._remove_writercGs|�|�|j||f|��S)zAdd a reader callback.)rer>)r$rrlrmrrr�
add_readerFs
z BaseSelectorEventLoop.add_readercCs|�|�|�|�S)zRemove a reader callback.)rer7)r$rrrr�
remove_readerKs
z#BaseSelectorEventLoop.remove_readercGs|�|�|j||f|��S)zAdd a writer callback..)rert)r$rrlrmrrr�
add_writerPs
z BaseSelectorEventLoop.add_writercCs|�|�|�|�S)zRemove a writer callback.)reru)r$rrrr�
remove_writerUs
z#BaseSelectorEventLoop.remove_writerc�sDt|�|jr"|��dkr"td��|��}|�|d||�|IdHS)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.
        rzthe socket must be non-blockingN)rrI�
gettimeoutrcr^�
_sock_recv)r$r�n�futrrr�	sock_recvZszBaseSelectorEventLoop.sock_recvcCs�|dk	r|�|�|��rdSy|�|�}Wn`ttfk
rb|��}|�||j||||�Yn6tk
r�}z|�	|�Wdd}~XYnX|�
|�dS)N)rw�	cancelledrBrDrCr9rvr{r_�
set_exception�
set_result)r$r}�
registered_fdrr|r@rr\rrrr{hs
z BaseSelectorEventLoop._sock_recvc�sDt|�|jr"|��dkr"td��|��}|�|d||�|IdHS)z�Receive data from the socket.

        The received data is written into *buf* (a writable buffer).
        The return value is the number of bytes written.
        rzthe socket must be non-blockingN)rrIrzrcr^�_sock_recv_into)r$r�bufr}rrr�sock_recv_into}sz$BaseSelectorEventLoop.sock_recv_intocCs�|dk	r|�|�|��rdSy|�|�}Wn`ttfk
rb|��}|�||j||||�Yn6tk
r�}z|�	|�Wdd}~XYnX|�
|�dS)N)rwr�	recv_intorDrCr9rvr�r_r�r�)r$r}r�rr��nbytesrr\rrrr��s
z%BaseSelectorEventLoop._sock_recv_intoc�sTt|�|jr"|��dkr"td��|��}|r@|�|d||�n
|�d�|IdHS)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.
        rzthe socket must be non-blockingN)rrIrzrcr^�
_sock_sendallr�)r$rr@r}rrr�sock_sendall�s	
z"BaseSelectorEventLoop.sock_sendallc
Cs�|dk	r|�|�|��rdSy|�|�}WnFttfk
rHd}Yn,tk
rr}z|�|�dSd}~XYnX|t|�kr�|�d�n.|r�||d�}|�	�}|�
||j||||�dS)Nr)ryrrGrDrCr_r��lenr�r9rxr�)r$r}r�rr@r|r\rrrrr��s"

z#BaseSelectorEventLoop._sock_sendallc�s�t|�|jr"|��dkr"td��ttd�r8|jtjkrf|j||j|j	|d�IdH}|d\}}}}}|�
�}|�|||�|IdHS)zTConnect to a remote socket at address.

        This method is a coroutine.
        rzthe socket must be non-blocking�AF_UNIX)�family�proto�loopN)rrIrzrc�hasattrr<r�r�Z_ensure_resolvedr�r^�
_sock_connect)r$rr1ZresolvedrYr}rrr�sock_connect�sz"BaseSelectorEventLoop.sock_connectc
Cs�|��}y|�|�Wnjttfk
rV|�t�|j|��|�||j	|||�Yn6t
k
r�}z|�|�Wdd}~XYnX|�d�dS)N)
r9ZconnectrDrCZadd_done_callback�	functools�partial�_sock_connect_donerx�_sock_connect_cbr_r�r�)r$r}rr1rr\rrrr��sz#BaseSelectorEventLoop._sock_connectcCs|�|�dS)N)ry)r$rr}rrrr��sz(BaseSelectorEventLoop._sock_connect_donec
Cs�|��rdSy,|�tjtj�}|dkr6t|d|����WnBttfk
rPYn6tk
rz}z|�	|�Wdd}~XYnX|�
d�dS)NrzConnect call failed )rZ
getsockoptr<Z
SOL_SOCKETZSO_ERRORrHrDrCr_r�r�)r$r}rr1�errr\rrrr��sz&BaseSelectorEventLoop._sock_connect_cbc�sBt|�|jr"|��dkr"td��|��}|�|d|�|IdHS)aWAccept 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.
        rzthe socket must be non-blockingFN)rrIrzrcr^�_sock_accept)r$rr}rrr�sock_acceptsz!BaseSelectorEventLoop.sock_acceptc
Cs�|��}|r|�|�|��r"dSy|��\}}|�d�WnVttfk
rh|�||j|d|�Yn:t	k
r�}z|�
|�Wdd}~XYnX|�||f�dS)NFT)r9rwrrTr=rDrCrvr�r_r�r�)r$r}Z
registeredrrrZr1r\rrrr�s
z"BaseSelectorEventLoop._sock_acceptc	�sl|j|j=|��}|��|��IdHz|j|j|||dd�IdHS|��|rZ|��||j|j<XdS)NF)Zfallback)	r#�_sock_fd�
is_reading�
pause_reading�_make_empty_waiterZ
sock_sendfile�_sock�_reset_empty_waiter�resume_reading)r$Ztransp�file�offset�countr�rrr�_sendfile_natives
z&BaseSelectorEventLoop._sendfile_nativecCs�x~|D]v\}}|j|j}\}}|tj@rN|dk	rN|jrD|�|�n
|�|�|tj@r|dk	r|jrr|�|�q|�|�qWdS)N)	�fileobjr@rriZ
_cancelledr7Z
_add_callbackrsru)r$Z
event_listrror�rprqrrr�_process_events-s
z%BaseSelectorEventLoop._process_eventscCs|�|���|��dS)N)r7r9r6)r$rrrr�
_stop_serving;sz#BaseSelectorEventLoop._stop_serving)N)N)N)NNN),r�
__module__�__qualname__�__doc__rr*rZSSL_HANDSHAKE_TIMEOUTr/r2r6r5r!rAr?rJrOrLrXrer>r7rtrurvrwrxryr~r{r�r�r�r�r�r�r�r�r�r�r�r�r��
__classcell__rr)rrr/sZ


+$
rcs�eZdZdZeZdZd�fdd�	Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zddd�Zdd�Zdd�Zdd�Zdd�Z�ZS) �_SelectorTransportiNcs�t��||�||jd<y|��|jd<Wntk
rHd|jd<YnXd|jkr�y|��|jd<Wn tjk
r�d|jd<YnX||_|�	�|_
d|_|�|�||_
|��|_d|_d|_|j
dk	r�|j
��||j|j
<dS)Nr<ZsocknamerRFr)rr�_extraZgetsocknamerHZgetpeernamer<�errorr�r9r��_protocol_connected�set_protocol�_server�_buffer_factory�_buffer�
_conn_lost�_closingZ_attachr#)r$r�rr(r%r&)rrrrLs,






z_SelectorTransport.__init__cCs�|jjg}|jdkr |�d�n|jr0|�d�|�d|j���|jdk	r�|j��s�t|jj	|jt
j�}|rz|�d�n
|�d�t|jj	|jt
j�}|r�d}nd}|�
�}|�d|�d	|�d
��d�d�|��S)
N�closed�closingzfd=zread=pollingz	read=idle�pollingZidlezwrite=<z
, bufsize=�>z<{}>� )rrr��appendr�r��_loopr4rr rrirs�get_write_buffer_size�format�join)r$�infor��state�bufsizerrr�__repr__fs*



z_SelectorTransport.__repr__cCs|�d�dS)N)�_force_close)r$rrr�abort�sz_SelectorTransport.abortcCs||_d|_dS)NT)�	_protocolr�)r$r(rrrr��sz_SelectorTransport.set_protocolcCs|jS)N)r�)r$rrr�get_protocol�sz_SelectorTransport.get_protocolcCs|jS)N)r�)r$rrrrd�sz_SelectorTransport.is_closingcCsT|jr
dSd|_|j�|j�|jsP|jd7_|j�|j�|j�|jd�dS)NTr)	r�r�r7r�r�r�ru�	call_soon�_call_connection_lost)r$rrrr6�sz_SelectorTransport.closecCs.|jdk	r*tjd|��t|d�|j��dS)Nzunclosed transport )�source)r��warnings�warn�ResourceWarningr6)r$rrr�__del__�s
z_SelectorTransport.__del__�Fatal error on transportcCsNt|t�r(|j��r@tjd||dd�n|j�||||jd��|�|�dS)Nz%r: %sT)rF)rPrQr]r()	rrHr��	get_debugrrrWr�r�)r$r\rPrrr�_fatal_error�s

z_SelectorTransport._fatal_errorcCsd|jr
dS|jr(|j��|j�|j�|jsBd|_|j�|j�|jd7_|j�|j	|�dS)NTr)
r�r��clearr�rur�r�r7r�r�)r$r\rrrr��s
z_SelectorTransport._force_closecCsVz|jr|j�|�Wd|j��d|_d|_d|_|j}|dk	rP|��d|_XdS)N)r�r�Zconnection_lostr�r6r�r�Z_detach)r$r\r&rrrr��s
z(_SelectorTransport._call_connection_lostcCs
t|j�S)N)r�r�)r$rrrr��sz(_SelectorTransport.get_write_buffer_sizecGs"|jr
dS|jj||f|��dS)N)r�r�r>)r$rrlrmrrrr>�sz_SelectorTransport._add_reader)NN)r�)rr�r��max_size�	bytearrayr�r�rr�r�r�r�rdr6r�r�r�r�r�r>r�rr)rrr�@s 

r�cs�eZdZdZejjZd#�fdd�	Z�fdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z�fdd�Zdd �Zd!d"�Z�ZS)$r'TNcs~d|_t��|||||�d|_d|_d|_t�|j�|j	�
|jj|�|j	�
|j
|j|j�|dk	rz|j	�
tj|d�dS)NF)�_read_ready_cbrr�_eof�_paused�
_empty_waiterrZ_set_nodelayr�r�r�r��connection_mader>r��_read_readyr�_set_result_unless_cancelled)r$r�rr(r)r%r&)rrrr�s

z!_SelectorSocketTransport.__init__cs.t|tj�r|j|_n|j|_t��|�dS)N)rrZBufferedProtocol�_read_ready__get_bufferr��_read_ready__data_receivedrr�)r$r()rrrr��s
z%_SelectorSocketTransport.set_protocolcCs|jo|jS)N)r�r�)r$rrrr��sz#_SelectorSocketTransport.is_readingcCs>|js|jrdSd|_|j�|j�|j��r:t�d|�dS)NTz%r pauses reading)r�r�r�r7r�r�rr)r$rrrr��s
z&_SelectorSocketTransport.pause_readingcCs@|js|jsdSd|_|�|j|j�|j��r<t�d|�dS)NFz%r resumes reading)	r�r�r>r�r�r�r�rr)r$rrrr�s
z'_SelectorSocketTransport.resume_readingcCs|��dS)N)r�)r$rrrr�sz$_SelectorSocketTransport._read_readyc
Cs|jr
dSy |j�d�}t|�s(td��Wn.tk
rX}z|�|d�dSd}~XYnXy|j�|�}WnDt	t
fk
r�dStk
r�}z|�|d�dSd}~XYnX|s�|��dSy|j�|�Wn0tk
�r}z|�|d�Wdd}~XYnXdS)N���z%get_buffer() returned an empty bufferz/Fatal error: protocol.get_buffer() call failed.z$Fatal read error on socket transportz3Fatal error: protocol.buffer_updated() call failed.)
r�r�Z
get_bufferr�r3r_r�r�r�rDrC�_read_ready__on_eofZbuffer_updated)r$r�r\r�rrrr�s2z0_SelectorSocketTransport._read_ready__get_bufferc
Cs�|jr
dSy|j�|j�}WnDttfk
r4dStk
r`}z|�|d�dSd}~XYnX|sr|��dSy|j	�
|�Wn.tk
r�}z|�|d�Wdd}~XYnXdS)Nz$Fatal read error on socket transportz2Fatal error: protocol.data_received() call failed.)r�r�rBr�rDrCr_r�r�r�Z
data_received)r$r@r\rrrr�*s"z3_SelectorSocketTransport._read_ready__data_receivedc
Cst|j��rt�d|�y|j��}Wn.tk
rR}z|�|d�dSd}~XYnX|rh|j�|j	�n|�
�dS)Nz%r received EOFz1Fatal error: protocol.eof_received() call failed.)r�r�rrr�Zeof_receivedr_r�r7r�r6)r$Z	keep_openr\rrrr�?s
z,_SelectorSocketTransport._read_ready__on_eofc
Cst|tttf�s$tdt|�j����|jr2td��|j	dk	rDtd��|sLdS|j
rz|j
tjkrht
�d�|j
d7_
dS|j�s�y|j�|�}WnDttfk
r�YnBtk
r�}z|�|d�dSd}~XYnX||d�}|s�dS|j�|j|j�|j�|�|��dS)Nz/data argument must be a bytes-like object, not z%Cannot call write() after write_eof()z(unable to write; sendfile is in progresszsocket.send() raised exception.rz%Fatal write error on socket transport)r�bytesr��
memoryviewr�typerr�r3r�r�r�!LOG_THRESHOLD_FOR_CONNLOST_WRITESr�warningr�r�rGrDrCr_r�r�rtr��_write_ready�extend�_maybe_pause_protocol)r$r@r|r\rrr�writeRs6

z_SelectorSocketTransport.writec
Cs�|jr
dSy|j�|j�}Wnrttfk
r4Yn�tk
r�}z>|j�|j	�|j�
�|�|d�|jdk	r~|j�
|�Wdd}~XYnjX|r�|jd|�=|��|js�|j�|j	�|jdk	r�|j�d�|jr�|�d�n|jr�|j�tj�dS)Nz%Fatal write error on socket transport)r�r�rGr�rDrCr_r�rur�r�r�r�r��_maybe_resume_protocolr�r�r�r��shutdownr<�SHUT_WR)r$r|r\rrrr�ws.


z%_SelectorSocketTransport._write_readycCs.|js|jrdSd|_|js*|j�tj�dS)NT)r�r�r�r�r�r<r�)r$rrr�	write_eof�s
z"_SelectorSocketTransport.write_eofcCsdS)NTr)r$rrr�
can_write_eof�sz&_SelectorSocketTransport.can_write_eofcs*t��|�|jdk	r&|j�td��dS)NzConnection is closed by peer)rr�r�r��ConnectionError)r$r\)rrrr��s
z._SelectorSocketTransport._call_connection_lostcCs6|jdk	rtd��|j��|_|js0|j�d�|jS)NzEmpty waiter is already set)r�r3r�r^r�r�)r$rrrr��s
z+_SelectorSocketTransport._make_empty_waitercCs
d|_dS)N)r�)r$rrrr��sz,_SelectorSocketTransport._reset_empty_waiter)NNN)rr�r�Z_start_tls_compatiblerZ
_SendfileModeZ
TRY_NATIVEZ_sendfile_compatiblerr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr)rrr'�s&%r'csFeZdZejZd�fdd�	Zdd�Zdd�Zd
dd	�Z	d
d�Z
�ZS)r0Ncs^t��||||�||_|j�|jj|�|j�|j|j|j	�|dk	rZ|j�t
j|d�dS)N)rr�_addressr�r�r�r�r>r�r�rr�)r$r�rr(r1r)r%)rrrr�s

z#_SelectorDatagramTransport.__init__cCstdd�|jD��S)Ncss|]\}}t|�VqdS)N)r�)�.0r@rYrrr�	<genexpr>�szC_SelectorDatagramTransport.get_write_buffer_size.<locals>.<genexpr>)�sumr�)r$rrrr��sz0_SelectorDatagramTransport.get_write_buffer_sizec
Cs�|jr
dSy|j�|j�\}}Wnpttfk
r8Ynhtk
rd}z|j�|�Wdd}~XYn<t	k
r�}z|�
|d�Wdd}~XYnX|j�||�dS)Nz&Fatal read error on datagram transport)r�r�Zrecvfromr�rDrCrHr��error_receivedr_r�Zdatagram_received)r$r@r[r\rrrr��sz&_SelectorDatagramTransport._read_readyc
Csdt|tttf�s$tdt|�j����|s,dS|jrV|d|jfkrPtd|j����|j}|j	r�|jr�|j	t
jkrxt�
d�|j	d7_	dS|j�sDy*|jdr�|j�|�n|j�||�dSttfk
r�|j�|j|j�Yn^tk
�r}z|j�|�dSd}~XYn0tk
�rB}z|�|d�dSd}~XYnX|j�t|�|f�|��dS)Nz/data argument must be a bytes-like object, not z!Invalid address: must be None or zsocket.send() raised exception.rrRz'Fatal write error on datagram transport) rr�r�r�rr�rr�rcr�rr�rr�r�r�r�rG�sendtorDrCr�rtr��
_sendto_readyrHr�r�r_r�r�r�)r$r@r[r\rrrr��s>

z!_SelectorDatagramTransport.sendtoc
Cs�x�|jr�|j��\}}y*|jdr0|j�|�n|j�||�Wqttfk
rj|j�||f�PYqt	k
r�}z|j
�|�dSd}~XYqtk
r�}z|�
|d�dSd}~XYqXqW|��|js�|j�|j�|jr�|�d�dS)NrRz'Fatal write error on datagram transport)r��popleftr�r�rGr�rDrC�
appendleftrHr�r�r_r�r�r�rur�r�r�)r$r@r[r\rrrr��s*
z(_SelectorDatagramTransport._sendto_ready)NNN)N)rr�r��collections�dequer�rr�r�r�r�r�rr)rrr0�s
)r0)r��__all__r�rVr�rr<r�r"r�ImportError�rrrrrr	r
�logrrrZ
BaseEventLooprZ_FlowControlMixinZ	Transportr�r'r0rrrr�<module>sB
_