Your IP : 18.191.192.113


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/asyncore.cpython-39.opt-2.pyc

a

R�f�N�@sbddlZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZee
ee
eeeh�ZzeWney�iZYn0dd�ZGdd�de�ZeeefZdd�Zd	d
�Zdd�Z d
d�Z!d%dd�Z"d&dd�Z#e#Z$d'dd�Z%Gdd�d�Z&Gdd�de&�Z'dd�Z(d(dd�Z)ej*d k�r^Gd!d"�d"�Z+Gd#d$�d$e&�Z,dS))�N)
�EALREADY�EINPROGRESS�EWOULDBLOCK�
ECONNRESET�EINVAL�ENOTCONN�	ESHUTDOWN�EISCONN�EBADF�ECONNABORTED�EPIPE�EAGAIN�	errorcodec
CsFzt�|�WStttfy@|tvr4t|YSd|YS0dS)NzUnknown error %s)�os�strerror�
ValueError�
OverflowError�	NameErrorr)�err�r�-/opt/alt/python39/lib64/python3.9/asyncore.py�	_strerrorDsrc@seZdZdS)�ExitNowN)�__name__�
__module__�__qualname__rrrrrLsrcCs8z|��Wn&ty �Yn|��Yn0dS�N)�handle_read_event�_reraised_exceptions�handle_error��objrrr�readQsr"cCs8z|��Wn&ty �Yn|��Yn0dSr)�handle_write_eventrrr rrr�writeYsr$cCs8z|��Wn&ty �Yn|��Yn0dSr)�handle_expt_eventrrr rrr�
_exceptionasr&c
Cs�zX|tj@r|��|tj@r&|��|tj@r8|��|tjtjBtj	B@rV|�
�Wnhty�}z,|jdt
vr�|��n|�
�WYd}~n.d}~0ty��Yn|��Yn0dS�Nr)�select�POLLINr�POLLOUTr#�POLLPRIr%ZPOLLHUPZPOLLERRZPOLLNVAL�handle_close�OSError�args�
_DISCONNECTEDrr)r!�flags�errr�	readwriteis"



r2�c	Cs<|durt}|�r8g}g}g}t|���D]L\}}|��}|��}|rP|�|�|rd|jsd|�|�|sl|r*|�|�q*g|kr�|kr�|kr�nnt�|�dSt	�	||||�\}}}|D] }|�
|�}|dur�q�t|�q�|D]"}|�
|�}|du�rq�t|�q�|D]&}|�
|�}|du�r,�qt
|��qdSr)�
socket_map�list�items�readable�writable�append�	accepting�time�sleepr(�getr"r$r&)	�timeout�map�r�wr1�fdr!Zis_rZis_wrrr�poll}s@


"







rCcCs�|durt}|dur t|d�}t��}|r�t|���D]L\}}d}|��r\|tjtjBO}|�	�rt|j
st|tjO}|r8|�||�q8|�|�}|D]&\}}|�
|�}|dur�q�t||�q�dS)Ni�r)r4�intr(rCr5r6r7r)r+r8r:r*�registerr=r2)r>r?ZpollsterrBr!r0r@rrr�poll2�s(


rF�>@FcCsb|durt}|r ttd�r t}nt}|dur>|r^|||�q,n |r^|dkr^|||�|d}q>dS)NrCr�)r4�hasattrr(rFrC)r>Zuse_pollr?�countZpoll_funrrr�loop�s
rKc@s2eZdZdZdZdZdZdZdZe	dh�Z
dAdd�Zdd�ZdBdd	�Z
dCd
d�Zejejfdd
�ZdDdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdEd'd(�Zd)d*�Z d+d,�Z!d-d.�Z"d/d0�Z#d1d2�Z$d3d4�Z%d5d6�Z&d7d8�Z'd9d:�Z(d;d<�Z)d=d>�Z*d?d@�Z+dS)F�
dispatcherFN�warningc
Cs�|durt|_n||_d|_|r�|�d�|�||�d|_z|��|_Wq�ty�}z2|j	dt
tfvrtd|_n|�|��WYd}~q�d}~00nd|_
dS)NFTr)r4�_map�_fileno�setblocking�
set_socket�	connectedZgetpeername�addrr-r.rr�del_channel�socket)�self�sockr?rrrr�__init__�s 

zdispatcher.__init__cCs�|jjd|jjg}|jr.|jr.|�d�n|jr>|�d�|jdur�z|�d|j�Wn"ty~|�t|j��Yn0dd�	|�t
|�fS)N�.Z	listeningrRz%s:%dz<%s at %#x>� )�	__class__rrr:rSr9rR�	TypeError�repr�join�id)rVZstatusrrr�__repr__�s

zdispatcher.__repr__cCs|dur|j}|||j<dSr)rNrO)rVr?rrr�add_channel	szdispatcher.add_channelcCs,|j}|dur|j}||vr"||=d|_dSr)rOrN)rVr?rBrrrrTszdispatcher.del_channelcCs.||f|_t�||�}|�d�|�|�dS)NF)Zfamily_and_typerUrPrQ)rVZfamily�typerWrrr�
create_sockets

zdispatcher.create_socketcCs||_|��|_|�|�dSr)rU�filenorOra�rVrWr?rrrrQs
zdispatcher.set_socketcCsBz*|j�tjtj|j�tjtj�dB�Wnty<Yn0dS)NrH)rUZ
setsockopt�
SOL_SOCKETZSO_REUSEADDR�
getsockoptr-�rVrrr�set_reuse_addr#s
���zdispatcher.set_reuse_addrcCsdS�NTrrhrrrr74szdispatcher.readablecCsdSrjrrhrrrr87szdispatcher.writablecCs(d|_tjdkr|dkrd}|j�|�S)NT�nt�)r:r�namerU�listen)rVZnumrrrrn>szdispatcher.listencCs||_|j�|�Sr)rSrU�bind)rVrSrrrroDszdispatcher.bindcCspd|_d|_|j�|�}|tttfvs8|tkrBtj	dkrB||_
dS|dtfvr^||_
|��nt
|t|��dS)NFTrkr)rR�
connectingrUZ
connect_exrrrrrrmrSr	�handle_connect_eventr-r)rVZaddressrrrr�connectHs��
zdispatcher.connectc
Cszz|j��\}}WnZty&YdStyl}z0|jdtttfvrVWYd}~dS�WYd}~nd}~00||fSdSr')rU�acceptr\r-r.rrr
)rVZconnrS�whyrrrrsVszdispatcher.acceptc
Cs~z|j�|�}|WStyx}zN|jdtkr>WYd}~dS|jdtvrb|��WYd}~dS�WYd}~n
d}~00dSr')rU�sendr-r.rr/r,)rV�data�resultrtrrrrudszdispatcher.sendc
Csxz(|j�|�}|s |��WdS|WSWnJtyr}z2|jdtvr\|��WYd}~dS�WYd}~n
d}~00dS)N�r)rU�recvr,r-r.r/)rVZbuffer_sizervrtrrrryqs
zdispatcher.recvc
Cspd|_d|_d|_|��|jdurlz|j��Wn8tyj}z |jdtt	fvrV�WYd}~n
d}~00dS)NFr)
rRr:rprTrU�closer-r.rr
)rVrtrrrrz�s
zdispatcher.closecCstj�dt|��dS)Nzlog: %s
)�sys�stderrr$�str)rV�messagerrr�log�szdispatcher.log�infocCs||jvrtd||f�dS)Nz%s: %s)�ignore_log_types�print)rVr~rbrrr�log_info�s
zdispatcher.log_infocCs:|jr|��n&|js.|jr$|��|��n|��dSr)r:�
handle_acceptrRrprq�handle_readrhrrrr�s

zdispatcher.handle_read_eventcCs@|j�tjtj�}|dkr(t|t|���|��d|_d|_dS)NrTF)	rUrgrf�SO_ERRORr-r�handle_connectrRrp�rVrrrrrq�szdispatcher.handle_connect_eventcCs*|jr
dS|js|jr|��|��dSr)r:rRrprq�handle_writerhrrrr#�szdispatcher.handle_write_eventcCs0|j�tjtj�}|dkr$|��n|��dSr')rUrgrfr�r,�handle_exptr�rrrr%�s
zdispatcher.handle_expt_eventcCsXt�\}}}}zt|�}Wndt|�}Yn0|�d||||fd�|��dS)Nz)<__repr__(self) failed for object at %0x>z:uncaptured python exception, closing channel %s (%s:%s %s)�error)�compact_tracebackr]r_r�r,)rVZnil�t�v�tbinfoZ	self_reprrrrr�s��	zdispatcher.handle_errorcCs|�dd�dS)Nz!unhandled incoming priority eventrM�r�rhrrrr��szdispatcher.handle_exptcCs|�dd�dS)Nzunhandled read eventrMr�rhrrrr��szdispatcher.handle_readcCs|�dd�dS)Nzunhandled write eventrMr�rhrrrr��szdispatcher.handle_writecCs|�dd�dS)Nzunhandled connect eventrMr�rhrrrr��szdispatcher.handle_connectcCs|��}|dur|j|�dSr)rs�handle_accepted)rVZpairrrrr��szdispatcher.handle_acceptcCs|��|�dd�dS)Nzunhandled accepted eventrM)rzr�)rVrWrSrrrr��szdispatcher.handle_acceptedcCs|�dd�|��dS)Nzunhandled close eventrM)r�rzrhrrrr,�szdispatcher.handle_close)NN)N)N)N)r�),rrr�debugrRr:rp�closingrS�	frozensetr�rXr`rarTrUZAF_INETZSOCK_STREAMrcrQrir7r8rnrorrrsruryrzrr�rrqr#r%rr�r�r�r�r�r�r,rrrrrL�sJ

 

	


rLc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�dispatcher_with_sendNcCst�|||�d|_dS)Nrx)rLrX�
out_bufferrerrrrX�szdispatcher_with_send.__init__cCs.d}t�||jdd��}|j|d�|_dS)Nri)rLrur�)rVZnum_sentrrr�
initiate_sendsz"dispatcher_with_send.initiate_sendcCs|��dSr)r�rhrrrr�sz!dispatcher_with_send.handle_writecCs|jpt|j�Sr)rR�lenr�rhrrrr8szdispatcher_with_send.writablecCs0|jr|�dt|��|j||_|��dS)Nz
sending %s)r�r�r]r�r�)rVrvrrrruszdispatcher_with_send.send)NN)rrrrXr�r�r8rurrrrr��s

r�cCs�t��\}}}g}|std��|rL|�|jjj|jjjt|j	�f�|j
}q~|d\}}}d�dd�|D��}|||f|||fS)Nztraceback does not exist���rZcSsg|]}d|�qS)z
[%s|%s|%s]r)�.0�xrrr�
<listcomp>&rxz%compact_traceback.<locals>.<listcomp>)r{�exc_info�AssertionErrorr9�tb_frame�f_code�co_filename�co_namer}�	tb_lineno�tb_nextr^)r�r��tbr��fileZfunction�liner�rrrr�s�r�cCs�|durt}t|���D]n}z|��Wqtyb}z"|jdtkrHn|sN�WYd}~qd}~0tyt�Yq|s��Yq0q|��dSr')	r4r5�valuesrzr-r.r
r�clear)r?Z
ignore_allr�rrr�	close_all)s 
r��posixc@sNeZdZdd�Zdd�Zdd�Zdd�Zdd
d�ZeZeZ	dd
�Z
dd�Zd	S)�file_wrappercCst�|�|_dSr)r�duprB�rVrBrrrrXNszfile_wrapper.__init__cCs*|jdkrtjd|t|d�|��dS)Nrzunclosed file %r)�source)rB�warnings�warn�ResourceWarningrzrhrrr�__del__Qs

�zfile_wrapper.__del__cGstj|jg|�R�Sr)rr"rB�rVr.rrrryWszfile_wrapper.recvcGstj|jg|�R�Sr)rr$rBr�rrrruZszfile_wrapper.sendNcCs(|tjkr|tjkr|sdStd��dS)Nrz-Only asyncore specific behaviour implemented.)rUrfr��NotImplementedError)rV�levelZoptnameZbuflenrrrrg]s
��zfile_wrapper.getsockoptcCs(|jdkrdS|j}d|_t�|�dS)Nrr�)rBrrzr�rrrrzhs

zfile_wrapper.closecCs|jSr)rBrhrrrrdoszfile_wrapper.fileno)N)rrrrXr�ryrurgr"r$rzrdrrrrr�Is
r�c@seZdZddd�Zdd�ZdS)�file_dispatcherNcCsNt�|d|�d|_z|��}Wnty2Yn0|�|�t�|d�dS)NTF)rLrXrRrd�AttributeError�set_filer�set_blocking)rVrBr?rrrrXts
zfile_dispatcher.__init__cCs"t|�|_|j��|_|��dSr)r�rUrdrOrar�rrrr�s
zfile_dispatcher.set_file)N)rrrrXr�rrrrr�rs
r�)r3N)r3N)rGFNN)NF)-r(rUr{r;r�r�errnorrrrrrrr	r
rrr
rr�r/r4rr�	Exceptionr�KeyboardInterrupt�
SystemExitrr"r$r&r2rCrFZpoll3rKrLr�r�r�rmr�r�rrrr�<module>1sB<�


'

*
)

?>