Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.145.158.111
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : asyncore.cpython-310.pyc
o

^b	O�@sxdZddlZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZejdedd�eee
eeeeh�ZzeWneyYiZYnwdd�ZGd	d
�d
e�ZeeefZ dd�Z!d
d�Z"dd�Z#dd�Z$d)dd�Z%d)dd�Z&e&Z'd*dd�Z(Gdd�d�Z)Gdd�de)�Z*d d!�Z+d+d"d#�Z,ej-d$kr�Gd%d&�d&�Z.Gd'd(�d(e)�Z/dSdS),a�Basic infrastructure for asynchronous socket service clients and servers.

There are only two ways to have a program on a single processor do "more
than one thing at a time".  Multi-threaded programming is the simplest and
most popular way to do it, but there is another very different technique,
that lets you have nearly all the advantages of multi-threading, without
actually using multiple threads. it's really only practical if your program
is largely I/O bound. If your program is CPU bound, then pre-emptive
scheduled threads are probably what you really need. Network servers are
rarely CPU-bound, however.

If your operating system supports the select() system call in its I/O
library (and nearly all do), then you can use it to juggle multiple
communication channels at once; doing other work while your I/O is taking
place in the "background."  Although this strategy can seem strange and
complex, especially at first, it is in many ways easier to understand and
control than multi-threaded programming. The module documented here solves
many of the difficult problems for you, making the task of building
sophisticated high-performance network servers and clients a snap.
�N)
�EALREADY�EINPROGRESS�EWOULDBLOCK�
ECONNRESET�EINVAL�ENOTCONN�	ESHUTDOWN�EISCONN�EBADF�ECONNABORTED�EPIPE�EAGAIN�	errorcodezIThe asyncore module is deprecated. The recommended replacement is asyncio�)�
stacklevelc
CsBzt�|�WStttfy |tvrt|YSd|YSw)NzUnknown error %s)�os�strerror�
ValueError�
OverflowError�	NameErrorr)�err�r�1/usr/local/python-3.10/lib/python3.10/asyncore.py�	_strerrorKs�rc@seZdZdS)�ExitNowN)�__name__�
__module__�__qualname__rrrrrSsrcC�2z|��WdSty�|��YdS�N)�handle_read_event�_reraised_exceptions�handle_error��objrrr�readX�r%cCrr)�handle_write_eventr!r"r#rrr�write`r&r(cCrr)�handle_expt_eventr!r"r#rrr�
_exceptionhr&r*c
Cs�z0|tj@r
|��|tj@r|��|tj@r|��|tjtjBtj	B@r.|�
�WdSWdStyX}z|jt
vrB|��n|�
�WYd}~dSWYd}~dSd}~wty_�|��YdSr)�select�POLLINr �POLLOUTr'�POLLPRIr)�POLLHUP�POLLERR�POLLNVAL�handle_close�OSError�errno�
_DISCONNECTEDr"r!)r$�flags�errr�	readwriteps(


�

��r8�c	Cs6|durt}|r�g}g}g}t|���D]&\}}|��}|��}|r'|�|�|r1|js1|�|�|s5|r:|�|�qg|krJ|krJ|krSnnt�|�dSt	�	||||�\}}}|D]}|�
|�}|durlq`t|�q`|D]}|�
|�}|durqst|�qs|D]}|�
|�}|dur�q�t
|�q�dSdSr)�
socket_map�list�items�readable�writable�append�	accepting�time�sleepr+�getr%r(r*)	�timeout�map�r�wr7�fdr$Zis_rZis_wrrr�poll�sF



�"






�rIcCs�|durt}|durt|d�}t��}|r^t|���D]&\}}d}|��r.|tjtjBO}|�	�r:|j
s:|tjO}|rB|�||�q|�|�}|D]\}}|�
|�}|durXqJt||�qJdSdS)Ni�r)r:�intr+rIr;r<r=r,r.r>r@r-�registerrCr8)rDrEZpollsterrHr$r6rFrrr�poll2�s.
�

�rL�>@FcCs�|durt}|rttd�rt}nt}|dur#|r!|||�|sdSdS|r:|dkr>|||�|d}|r<|dks)dSdSdSdS)NrIr�)r:�hasattrr+rLrI)rDZuse_pollrE�countZpoll_funrrr�loop�s
�
�rQc@s2eZdZdZdZdZdZdZdZe	dh�Z
dAdd�Zdd�ZdBdd	�Z
dBd
d�Zejejfdd
�ZdBdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdCd'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)D�
dispatcherFN�warningc
Cs�|durt|_n||_d|_|rK|�d�|�||�d|_z|��|_WdStyJ}z|j	t
tfvr9d|_n|�|��WYd}~dSd}~wwd|_
dS)NFT)r:�_map�_fileno�setblocking�
set_socket�	connected�getpeername�addrr3r4rr�del_channel�socket)�self�sockrErrrr�__init__�s&

���
zdispatcher.__init__cCs�|jjd|jjg}|jr|jr|�d�n|jr|�d�|jdur@z
|�d|j�Wnty?|�t|j��Ynwdd�	|�t
|�fS)N�.Z	listeningrXz%s:%dz<%s at %#x>� )�	__class__rrr@rZr?rX�	TypeError�repr�join�id)r]�statusrrr�__repr__s

�zdispatcher.__repr__cCs|dur|j}|||j<dSr)rTrU)r]rErrr�add_channelszdispatcher.add_channelcCs,|j}|dur
|j}||vr||=d|_dSr)rUrT)r]rErHrrrr[s
zdispatcher.del_channelcCs.||f|_t�||�}|�d�|�|�dS�NF)Zfamily_and_typer\rVrW)r]�family�typer^rrr�
create_sockets

zdispatcher.create_socketcCs||_|��|_|�|�dSr)r\�filenorUri�r]r^rErrrrW%s
zdispatcher.set_socketcCsBz|j�tjtj|j�tjtj�dB�WdSty YdSw)NrN)r\�
setsockopt�
SOL_SOCKET�SO_REUSEADDR�
getsockoptr3�r]rrr�set_reuse_addr*s
��
��zdispatcher.set_reuse_addrcC�dS�NTrrtrrrr=;�zdispatcher.readablecCrvrwrrtrrrr>>rxzdispatcher.writablecCs(d|_tjdkr|dkrd}|j�|�S)NT�nt�)r@r�namer\�listen)r]�numrrrr|Eszdispatcher.listencCs||_|j�|�Sr)rZr\�bind)r]rZrrrr~Kszdispatcher.bindcCsnd|_d|_|j�|�}|tttfvs|tkr!tj	dkr!||_
dS|dtfvr0||_
|��dSt
|t|��)NFTryr)rX�
connectingr\�
connect_exrrrrrr{rZr	�handle_connect_eventr3r)r]�addressrrrr�connectOs��zdispatcher.connectc
Csdz|j��\}}W||fStyYdSty1}z|jtttfvr,WYd}~dS�d}~wwr)r\�acceptrcr3r4rrr
)r]�connrZ�whyrrrr�]s	���zdispatcher.acceptc
Csfz	|j�|�}|WSty2}z|jtkrWYd}~dS|jtvr-|��WYd}~dS�d}~ww�Nr)r\�sendr3r4rr5r2)r]�data�resultr�rrrr�ks

��zdispatcher.sendc
Cs`z|j�|�}|s|��WdS|WSty/}z|jtvr*|��WYd}~dS�d}~ww�N�)r\�recvr2r3r4r5)r]Zbuffer_sizer�r�rrrr�xs
��zdispatcher.recvc
Cspd|_d|_d|_|��|jdur6z|j��WdSty5}z|jtt	fvr*�WYd}~dSd}~wwdSrj)
rXr@rr[r\�closer3r4rr
)r]r�rrrr��s
����zdispatcher.closecCstj�dt|��dS)Nzlog: %s
)�sys�stderrr(�str)r]�messagerrr�log�szdispatcher.log�infocCs"||jvrtd||f�dSdS)Nz%s: %s)�ignore_log_types�print)r]r�rlrrr�log_info�s
�zdispatcher.log_infocCs>|jr	|��dS|js|jr|��|��dS|��dSr)r@�
handle_acceptrXrr��handle_readrtrrrr �szdispatcher.handle_read_eventcCs@|j�tjtj�}|dkrt|t|���|��d|_d|_dS)NrTF)	r\rsrq�SO_ERRORr3r�handle_connectrXr�r]rrrrr��s
zdispatcher.handle_connect_eventcCs*|jrdS|js|jr|��|��dSr)r@rXrr��handle_writertrrrr'�szdispatcher.handle_write_eventcCs2|j�tjtj�}|dkr|��dS|��dSr�)r\rsrqr�r2�handle_exptr�rrrr)�szdispatcher.handle_expt_eventcCsTt�\}}}}zt|�}Wn
dt|�}Y|�d||||fd�|��dS)Nz)<__repr__(self) failed for object at %0x>z:uncaptured python exception, closing channel %s (%s:%s %s)�error)�compact_tracebackrdrfr�r2)r]�nil�t�v�tbinfoZ	self_reprrrrr"�s��	zdispatcher.handle_errorcC�|�dd�dS)Nz!unhandled incoming priority eventrS�r�rtrrrr���zdispatcher.handle_exptcCr�)Nzunhandled read eventrSr�rtrrrr��r�zdispatcher.handle_readcCr�)Nzunhandled write eventrSr�rtrrrr��r�zdispatcher.handle_writecCr�)Nzunhandled connect eventrSr�rtrrrr��r�zdispatcher.handle_connectcCs"|��}|dur|j|�dSdSr)r��handle_accepted)r]Zpairrrrr��s�zdispatcher.handle_acceptcCs|��|�dd�dS)Nzunhandled accepted eventrS)r�r�)r]r^rZrrrr��szdispatcher.handle_acceptedcCs|�dd�|��dS)Nzunhandled close eventrS)r�r�rtrrrr2�szdispatcher.handle_close�NNr)r�),rrr�debugrXr@r�closingrZ�	frozensetr�r_rhrir[r\�AF_INET�SOCK_STREAMrmrWrur=r>r|r~r�r�r�r�r�r�r�r r�r'r)r"r�r�r�r�r�r�r2rrrrrR�sL

 

	


rRc@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�dispatcher_with_sendNcCst�|||�d|_dSr�)rRr_�
out_bufferrorrrr_s
zdispatcher_with_send.__init__cCs.d}t�||jdd��}|j|d�|_dS)Nri)rRr�r�)r]Znum_sentrrr�
initiate_sendsz"dispatcher_with_send.initiate_sendcCs|��dSr)r�rtrrrr�sz!dispatcher_with_send.handle_writecCs|jpt|j�Sr)rX�lenr�rtrrrr>szdispatcher_with_send.writablecCs0|jr|�dt|��|j||_|��dS)Nz
sending %s)r�r�rdr�r�)r]r�rrrr�szdispatcher_with_send.sendr�)rrrr_r�r�r>r�rrrrr�s
r�cCs�t��\}}}g}|std��|r'|�|jjj|jjjt|j	�f�|j
}|s~|d\}}}d�dd�|D��}|||f|||fS)Nztraceback does not exist���racSsg|]}d|�qS)z
[%s|%s|%s]r)�.0�xrrr�
<listcomp>-sz%compact_traceback.<locals>.<listcomp>)r��exc_info�AssertionErrorr?�tb_frame�f_code�co_filename�co_namer��	tb_lineno�tb_nextre)r�r��tbr��file�function�liner�rrrr�s ��	r�cCs�|durt}t|���D]1}z|��Wqty/}z|jtkr"n|s%�WYd}~qd}~wty6�|s<�Yq|��dSr)	r:r;�valuesr�r3r4r
r!�clear)rEZ
ignore_allr�rrr�	close_all0s$
��r��posixc@sNeZdZdd�Zdd�Zdd�Zdd�Zdd
d�ZeZeZ	dd
�Z
dd�Zd	S)�file_wrappercCst�|�|_dSr)r�duprH�r]rHrrrr_Ur�zfile_wrapper.__init__cCs*|jdkrtjd|t|d�|��dS)Nrzunclosed file %r)�source)rH�warnings�warn�ResourceWarningr�rtrrr�__del__Xs

�zfile_wrapper.__del__cG�tj|jg|�R�Sr)rr%rH�r]�argsrrrr�^�zfile_wrapper.recvcGr�r)rr(rHr�rrrr�ar�zfile_wrapper.sendNcCs$|tjkr|tjkr|sdStd��)Nrz-Only asyncore specific behaviour implemented.)r\rqr��NotImplementedError)r]�levelZoptname�buflenrrrrsds
��zfile_wrapper.getsockoptcCs(|jdkrdS|j}d|_t�|�dS)Nrr�)rHrr�r�rrrr�os

zfile_wrapper.closecCs|jSr)rHrtrrrrnvszfile_wrapper.filenor)rrrr_r�r�r�rsr%r(r�rnrrrrr�Ps
r�c@seZdZddd�Zdd�ZdS)�file_dispatcherNcCsNt�|d|�d|_z|��}Wn	tyYnw|�|�t�|d�dS)NTF)rRr_rXrn�AttributeError�set_filer�set_blocking)r]rHrErrrr_{s�
zfile_dispatcher.__init__cCs"t|�|_|j��|_|��dSr)r�r\rnrUrir�rrrr��s
zfile_dispatcher.set_filer)rrrr_r�rrrrr�ys
r�)r9N)rMFNNrj)0�__doc__r+r\r�rAr�rr4rrrrrrrr	r
rrr
rr��DeprecationWarningr�r5r:rr�	Exceptionr�KeyboardInterrupt�
SystemExitr!r%r(r*r8rIrLZpoll3rQrRr�r�r�r{r�r�rrrr�<module>sT<���


'
*

)�
© 2025 GrazzMean