AlkantarClanX12

Your IP : 18.188.140.232


Current Path : /usr/lib64/python3.6/asyncio/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/asyncio/__pycache__/proactor_events.cpython-36.opt-2.pyc

3


 \�O�@s�dgZddlZddlZddlmZddlmZddlmZddlmZddlmZdd	lm	Z	dd
l
mZGdd�de	je	j
�ZGd
d�dee	j�ZGdd�dee	j�ZGdd�de�ZGdd�deee	j�ZGdd�deee	j�ZGdd�dej�ZdS)�BaseProactorEventLoop�N�)�base_events)�compat)�	constants)�futures)�sslproto)�
transports)�loggercs~eZdZd�fdd�	Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	e
jrTdd�Zddd�Z
dd�Zdd�Zdd�Z�ZS)�_ProactorBasePipeTransportNcs�t�j||�|j|�||_||_||_d|_d|_d|_d|_	d|_
d|_d|_|jdk	rh|jj
�|jj|jj|�|dk	r�|jjtj|d�dS)NrF)�super�__init__�
_set_extra�_sock�	_protocol�_server�_buffer�	_read_fut�
_write_fut�_pending_write�
_conn_lost�_closing�_eof_writtenZ_attach�_loop�	call_soonZconnection_maderZ_set_result_unless_cancelled)�self�loop�sock�protocol�waiter�extra�server)�	__class__��//usr/lib64/python3.6/asyncio/proactor_events.pyr
s$



z#_ProactorBasePipeTransport.__init__cCs�|jjg}|jdkr |jd�n|jr0|jd�|jdk	rN|jd|jj��|jdk	rh|jd|j�|jdk	r�|jd|j�|jr�t	|j�}|jd|�|j
r�|jd�dd	j|�S)
N�closed�closingzfd=%szread=%szwrite=%rzwrite_bufsize=%szEOF writtenz<%s>� )r"�__name__r�appendr�filenorrr�lenr�join)r�info�bufsizer#r#r$�__repr__/s"







z#_ProactorBasePipeTransport.__repr__cCs||jd<dS)N�pipe)�_extra)rrr#r#r$rBsz%_ProactorBasePipeTransport._set_extracCs
||_dS)N)r)rrr#r#r$�set_protocolEsz'_ProactorBasePipeTransport.set_protocolcCs|jS)N)r)rr#r#r$�get_protocolHsz'_ProactorBasePipeTransport.get_protocolcCs|jS)N)r)rr#r#r$�
is_closingKsz%_ProactorBasePipeTransport.is_closingcCs^|jr
dSd|_|jd7_|jr@|jdkr@|jj|jd�|jdk	rZ|jj�d|_dS)NTr)	rrrrrr�_call_connection_lostr�cancel)rr#r#r$�closeNs

z _ProactorBasePipeTransport.closecCs*|jdk	r&tjd|t|d�|j�dS)Nzunclosed transport %r)�source)r�warnings�warn�ResourceWarningr7)rr#r#r$�__del__]s
z"_ProactorBasePipeTransport.__del__�Fatal error on pipe transportcCsPt|tj�r*|jj�rBtjd||dd�n|jj||||jd��|j	|�dS)Nz%r: %sT)�exc_info)�message�	exceptionZ	transportr)
�
isinstancerZ_FATAL_ERROR_IGNOREr�	get_debugr
�debug�call_exception_handlerr�_force_close)r�excr?r#r#r$�_fatal_errorcs
z'_ProactorBasePipeTransport._fatal_errorcCsj|jr
dSd|_|jd7_|jr4|jj�d|_|jrJ|jj�d|_d|_d|_|jj|j	|�dS)NTrr)
rrrr6rrrrrr5)rrFr#r#r$rEps

z'_ProactorBasePipeTransport._force_closecCs^z|jj|�Wdt|jd�r,|jjtj�|jj�d|_|j}|dk	rX|j	�d|_XdS)N�shutdown)
rZconnection_lost�hasattrrrH�socketZ	SHUT_RDWRr7rZ_detach)rrFr!r#r#r$r5s
z0_ProactorBasePipeTransport._call_connection_lostcCs"|j}|jdk	r|t|j�7}|S)N)rrr+)r�sizer#r#r$�get_write_buffer_size�s
z0_ProactorBasePipeTransport.get_write_buffer_size)NNN)r=)r(�
__module__�__qualname__r
r/rr2r3r4r7rZPY34r<rGrEr5rL�
__classcell__r#r#)r"r$rs

rcs8eZdZd
�fdd�	Zdd�Zdd�Zddd	�Z�ZS)�_ProactorReadPipeTransportNcs4t�j||||||�d|_d|_|jj|j�dS)NF)rr
�_paused�_reschedule_on_resumerr�
_loop_reading)rrrrrr r!)r"r#r$r
�sz#_ProactorReadPipeTransport.__init__cCs0|js|jrdSd|_|jj�r,tjd|�dS)NTz%r pauses reading)rrQrrBr
rC)rr#r#r$�
pause_reading�s

z(_ProactorReadPipeTransport.pause_readingcCsP|js|jrdSd|_|jr6|jj|j|j�d|_|jj�rLtj	d|�dS)NFz%r resumes reading)
rrQrRrrrSrrBr
rC)rr#r#r$�resume_reading�s
z)_ProactorReadPipeTransport.resume_readingcCs�|jrd|_dSd}�z"yH|dk	r0d|_|j�}|jr>d}dS|dkrJdS|jjj|jd�|_Wn�t	k
r�}z2|js�|j
|d�n|jj�r�tj
ddd�WYdd}~Xn�tk
r�}z|j|�WYdd}~Xn^tk
�r}z|j
|d�WYdd}~Xn0tjk
�r&|j�s"�YnX|jj|j�Wd|�rN|jj|�n:|dk	�r�|jj��rptj
d|�|jj�}|�s�|j�XdS)NT�iz"Fatal read error on pipe transportz*Read error on pipe transport while closing)r>z%r received EOF)rQrRr�resultrr�	_proactor�recvr�ConnectionAbortedErrorrGrBr
rC�ConnectionResetErrorrE�OSErrorr�CancelledError�add_done_callbackrSrZ
data_receivedZeof_receivedr7)r�fut�datarFZ	keep_openr#r#r$rS�sH


z(_ProactorReadPipeTransport._loop_reading)NNN)N)r(rMrNr
rTrUrSrOr#r#)r"r$rP�s

rPc@s6eZdZdd�Zddd�Zdd�Zdd	�Zd
d�ZdS)
�_ProactorBaseWritePipeTransportcCs�t|tttf�s&dt|�j}t|��|jr4td��|s<dS|j	rj|j	t
jkrXtj
d�|j	d7_	dS|jdkr�|jt|�d�n.|js�t|�|_|j�n|jj|�|j�dS)Nz3data argument must be a bytes-like object, not '%s'zwrite_eof() already calledzsocket.send() raised exception.r)r`)rA�bytes�	bytearray�
memoryview�typer(�	TypeErrorr�RuntimeErrorrrZ!LOG_THRESHOLD_FOR_CONNLOST_WRITESr
�warningr�
_loop_writingr�_maybe_pause_protocol�extend)rr`�msgr#r#r$�write�s(



z%_ProactorBaseWritePipeTransport.writeNcCsy�d|_d|_|r|j�|dkr.|j}d|_|sf|jrH|jj|jd�|jr\|j	j
tj�|j
�nN|jjj|j	|�|_|jj�s�t|�|_|jj|j�|j�n|jj|j�WnZtk
r�}z|j|�WYdd}~Xn0tk
�r}z|j|d�WYdd}~XnXdS)Nrz#Fatal write error on pipe transport)rrrWrrrrr5rrrHrJ�SHUT_WRZ_maybe_resume_protocolrX�send�doner+r^rirjr[rEr\rG)r�fr`rFr#r#r$ri
s0



z-_ProactorBaseWritePipeTransport._loop_writingcCsdS)NTr#)rr#r#r$�
can_write_eof0sz-_ProactorBaseWritePipeTransport.can_write_eofcCs|j�dS)N)r7)rr#r#r$�	write_eof3sz)_ProactorBaseWritePipeTransport.write_eofcCs|jd�dS)N)rE)rr#r#r$�abort6sz%_ProactorBaseWritePipeTransport.abort)NN)r(rMrNrmrirrrsrtr#r#r#r$ra�s
$
#racs$eZdZ�fdd�Zdd�Z�ZS)�_ProactorWritePipeTransportcs4t�j||�|jjj|jd�|_|jj|j�dS)N�)	rr
rrXrYrrr^�_pipe_closed)r�args�kw)r"r#r$r
;sz$_ProactorWritePipeTransport.__init__cCs@|j�rdS|jrdSd|_|jdk	r4|jt��n|j�dS)N)Z	cancelledrrrrE�BrokenPipeErrorr7)rr_r#r#r$rw@s
z(_ProactorWritePipeTransport._pipe_closed)r(rMrNr
rwrOr#r#)r"r$ru:sruc@seZdZdd�Zdd�ZdS)�_ProactorDuplexPipeTransportcCsdS)NFr#)rr#r#r$rrUsz*_ProactorDuplexPipeTransport.can_write_eofcCst�dS)N)�NotImplementedError)rr#r#r$rsXsz&_ProactorDuplexPipeTransport.write_eofN)r(rMrNrrrsr#r#r#r$r{Psr{cs6eZdZd
�fdd�	Zdd�Zdd�Zdd	�Z�ZS)�_ProactorSocketTransportNcs$t�j||||||�tj|�dS)N)rr
rZ_set_nodelay)rrrrrr r!)r"r#r$r
asz!_ProactorSocketTransport.__init__cCs�||jd<y|j�|jd<Wn4tjtfk
rP|jj�rLtjd|dd�YnXd|jkr�y|j	�|jd<Wn4tjtfk
r�|jj�r�tjd|dd�YnXdS)NrJZsocknamezgetsockname() failed on %rT)r>�peernamezgetpeername() failed on %r)
r1ZgetsocknamerJ�error�AttributeErrorrrBr
rhZgetpeername)rrr#r#r$rfs



z#_ProactorSocketTransport._set_extracCsdS)NTr#)rr#r#r$rrvsz&_ProactorSocketTransport.can_write_eofcCs2|js|jrdSd|_|jdkr.|jjtj�dS)NT)rrrrrHrJrn)rr#r#r$rsys

z"_ProactorSocketTransport.write_eof)NNN)r(rMrNr
rrrrsrOr#r#)r"r$r}\s
r}cs�eZdZ�fdd�Zd-dd�Zd.ddddd�dd	�Zd/d
d�Zd0dd
�Zd1dd�Z�fdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd2d d!�Zd"d#�Zd3d%d&�Zd'd(�Zd)d*�Zd+d,�Z�ZS)4rcsHt�j�tjd|jj�||_||_d|_i|_	|j
|�|j�dS)NzUsing proactor: %s)rr
r
rCr"r(rX�	_selector�_self_reading_future�_accept_futuresZset_loop�_make_self_pipe)rZproactor)r"r#r$r
�s

zBaseProactorEventLoop.__init__NcCst||||||�S)N)r})rrrrr r!r#r#r$�_make_socket_transport�s
z,BaseProactorEventLoop._make_socket_transportF)�server_side�server_hostnamer r!c
Cs<tj�std��tj||||||�}	t|||	||d�|	jS)NzOProactor event loop requires Python 3.5 or newer (ssl.MemoryBIO) to support SSL)r r!)rZ_is_sslproto_availabler|ZSSLProtocolr}Z_app_transport)
rZrawsockr�
sslcontextrr�r�r r!Zssl_protocolr#r#r$�_make_ssl_transport�s
z)BaseProactorEventLoop._make_ssl_transportcCst|||||�S)N)r{)rrrrr r#r#r$�_make_duplex_pipe_transport�sz1BaseProactorEventLoop._make_duplex_pipe_transportcCst|||||�S)N)rP)rrrrr r#r#r$�_make_read_pipe_transport�sz/BaseProactorEventLoop._make_read_pipe_transportcCst|||||�S)N)ru)rrrrr r#r#r$�_make_write_pipe_transport�sz0BaseProactorEventLoop._make_write_pipe_transportcsP|j�rtd��|j�rdS|j�|j�|jj�d|_d|_t�j�dS)Nz!Cannot close a running event loop)	Z
is_runningrg�	is_closed�_stop_accept_futures�_close_self_piperXr7r�r)r)r"r#r$r7�s
zBaseProactorEventLoop.closecCs|jj||�S)N)rXrY)rr�nr#r#r$�	sock_recv�szBaseProactorEventLoop.sock_recvcCs|jj||�S)N)rXro)rrr`r#r#r$�sock_sendall�sz"BaseProactorEventLoop.sock_sendallcCs|jj||�S)N)rXZconnect)rrZaddressr#r#r$�sock_connect�sz"BaseProactorEventLoop.sock_connectcCs|jj|�S)N)rX�accept)rrr#r#r$�sock_accept�sz!BaseProactorEventLoop.sock_acceptcCst�dS)N)r|)rr#r#r$�_socketpair�sz!BaseProactorEventLoop._socketpaircCsL|jdk	r|jj�d|_|jj�d|_|jj�d|_|jd8_dS)Nr)r�r6�_ssockr7�_csock�
_internal_fds)rr#r#r$r��s



z&BaseProactorEventLoop._close_self_pipecCsF|j�\|_|_|jjd�|jjd�|jd7_|j|j�dS)NFr)r�r�r�Zsetblockingr�r�_loop_self_reading)rr#r#r$r��s
z%BaseProactorEventLoop._make_self_pipecCs�y$|dk	r|j�|jj|jd�}WnHtjk
r:dStk
rl}z|jd||d��WYdd}~XnX||_|j	|j
�dS)Niz.Error on reading from the event loop self pipe)r?r@r)rWrXrYr�rr]�	ExceptionrDr�r^r�)rrqrFr#r#r$r��sz(BaseProactorEventLoop._loop_self_readingcCs|jjd�dS)N�)r�ro)rr#r#r$�_write_to_self�sz$BaseProactorEventLoop._write_to_self�dcs&d������fdd�	��j��dS)Ncs"y�|dk	rl|j�\}}�jr,tjd�||���}�dk	rV�j||�dd|i�d�n�j||d|i�d��j�rxdS�jj��}Wn~t	k
r�}zD�j
�dkr��jd|�d���j�n�jr�tjd	�dd
�WYdd}~Xn8t
jk
�r�j�YnX|�j�j
�<|j��dS)Nz#%r got a new connection from %r: %rTr~)r�r r!)r r!rzAccept failed on a socket)r?r@rJzAccept failed on socket %r)r>���)rWZ_debugr
rCr�r�r�rXr�r\r*rDr7rr]r�r^)rqZconnZaddrrrF)r�protocol_factoryrr!rr�r#r$r�s>


z2BaseProactorEventLoop._start_serving.<locals>.loop)N)r)rr�rr�r!Zbacklogr#)rr�rr!rr�r$�_start_serving�s$z$BaseProactorEventLoop._start_servingcCsdS)Nr#)rZ
event_listr#r#r$�_process_events sz%BaseProactorEventLoop._process_eventscCs*x|jj�D]}|j�qW|jj�dS)N)r��valuesr6�clear)rZfuturer#r#r$r�$sz*BaseProactorEventLoop._stop_accept_futurescCs |j�|jj|�|j�dS)N)r�rX�
_stop_servingr7)rrr#r#r$r�)sz#BaseProactorEventLoop._stop_serving)NNN)N)NN)NN)NN)N)NNr�)r(rMrNr
r�r�r�r�r�r7r�r�r�r�r�r�r�r�r�r�r�r�r�rOr#r#)r"r$r�s4







()�__all__rJr9�rrrrrr	�logr
Z_FlowControlMixinZ
BaseTransportrZ
ReadTransportrPZWriteTransportraruZ	Transportr{r}Z
BaseEventLooprr#r#r#r$�<module>s0MT
#