Your IP : 3.138.134.106


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/socketserver.cpython-310.opt-2.pyc

o

6��f�j�@s�	dZddlZddlZddlZddlZddlZddlmZddlm	Zgd�Z
eed�r3e
�gd��eed�r?e
�gd	��eed
�rHej
ZnejZGdd�d�ZGd
d�de�ZGdd�de�Zeed�rnGdd�d�ZGdd�de�ZGdd�d�ZGdd�d�Zeed�r�Gdd�dee�ZGdd�dee�ZGdd�dee�ZGdd �d ee�Zeed�r�Gd!d"�d"e�ZGd#d$�d$e�ZGd%d&�d&ee�ZGd'd(�d(ee�ZGd)d*�d*�Z Gd+d,�d,e �Z!Gd-d.�d.e�Z"Gd/d0�d0e �Z#dS)1z0.4�N)�BufferedIOBase)�	monotonic)	�
BaseServer�	TCPServer�	UDPServer�ThreadingUDPServer�ThreadingTCPServer�BaseRequestHandler�StreamRequestHandler�DatagramRequestHandler�ThreadingMixIn�fork)�ForkingUDPServer�ForkingTCPServer�ForkingMixIn�AF_UNIX)�UnixStreamServer�UnixDatagramServer�ThreadingUnixStreamServer�ThreadingUnixDatagramServer�PollSelectorc@s�eZdZ	dZdd�Zdd�Zd%dd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�ZdS)&rNcCs"	||_||_t��|_d|_dS�NF)�server_address�RequestHandlerClass�	threadingZEvent�_BaseServer__is_shut_down�_BaseServer__shutdown_request)�selfrr�r�3/opt/alt/python310/lib64/python3.10/socketserver.py�__init__�s


zBaseServer.__init__cC�	dS�Nr�rrrr�server_activate��zBaseServer.server_activate��?cCs�	|j��zIt��(}|�|tj�|js+|�|�}|jrn
|r$|��|�	�|jrWd�n1s5wYWd|_|j�
�dSWd|_|j�
�dSd|_|j�
�wr)r�clear�_ServerSelector�register�	selectors�
EVENT_READr�select�_handle_request_noblock�service_actions�set)rZ
poll_interval�selector�readyrrr�
serve_forever�s,

���
�
�zBaseServer.serve_forevercCs	d|_|j��dS�NT)rr�waitr#rrr�shutdown�szBaseServer.shutdowncCr!r"rr#rrrr.�r%zBaseServer.service_actionscCs�	|j��}|dur|j}n|jdurt||j�}|dur"t�|}t��4}|�|tj�	|�	|�}|r@|�
�Wd�S|durX|t�}|dkrX|��Wd�Sq.1s\wYdS)NTr)�socketZ
gettimeout�timeout�min�timer(r)r*r+r,r-�handle_timeout)rr7Zdeadliner0r1rrr�handle_requests,



�
��zBaseServer.handle_requestcCs�	z|��\}}Wn
tyYdSw|�||�rAz	|�||�WdSty8|�||�|�|�YdS|�|��|�|�dSr")�get_request�OSError�verify_request�process_request�	Exception�handle_error�shutdown_request�r�request�client_addressrrrr-/s �
z"BaseServer._handle_request_noblockcCr!r"rr#rrrr:FszBaseServer.handle_timeoutcCs	dSr3rrCrrrr>Mr%zBaseServer.verify_requestcCs	|�||�|�|�dSr")�finish_requestrBrCrrrr?UszBaseServer.process_requestcCr!r"rr#rrr�server_close^r%zBaseServer.server_closecCs	|�|||�dSr")rrCrrrrFfszBaseServer.finish_requestcCs	|�|�dSr"��
close_request�rrDrrrrBjszBaseServer.shutdown_requestcCr!r"rrJrrrrInszBaseServer.close_requestcCsB	tdtjd�td|tjd�ddl}|��tdtjd�dS)Nz(----------------------------------------)�filez4Exception occurred during processing of request fromr)�print�sys�stderr�	traceback�	print_exc)rrDrErOrrrrArs�zBaseServer.handle_errorcCs|Sr"rr#rrr�	__enter__�zBaseServer.__enter__cGs|��dSr")rG)r�argsrrr�__exit__�szBaseServer.__exit__)r&)�__name__�
__module__�__qualname__r7r r$r2r5r.r;r-r:r>r?rGrFrBrIrArQrTrrrrr�s(+

	
rc@sdeZdZ	ejZejZdZdZ	ddd�Z
dd�Zdd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�ZdS)r�FTcCsR	t�|||�t�|j|j�|_|r'z|��|��WdS|���dSr")rr r6�address_family�socket_type�server_bindr$rG)rrrZbind_and_activaterrrr �s��zTCPServer.__init__cCs:	|jr|j�tjtjd�|j�|j�|j��|_dS)N�)�allow_reuse_addressr6�
setsockoptZ
SOL_SOCKETZSO_REUSEADDRZbindrZgetsocknamer#rrrr[�s
zTCPServer.server_bindcCs	|j�|j�dSr")r6Zlisten�request_queue_sizer#rrrr$�szTCPServer.server_activatecCs	|j��dSr")r6�closer#rrrrG�szTCPServer.server_closecC�	|j��Sr")r6�filenor#rrrrb��
zTCPServer.filenocCrar")r6Zacceptr#rrrr<�rczTCPServer.get_requestcCs4	z|�tj�Wn	tyYnw|�|�dSr")r5r6ZSHUT_WRr=rIrJrrrrB�s�zTCPServer.shutdown_requestcCs	|��dSr")r`rJrrrrI�szTCPServer.close_requestN)T)rUrVrWr6ZAF_INETrYZSOCK_STREAMrZr_r]r r[r$rGrbr<rBrIrrrrr�s-


rc@s<eZdZ	dZejZdZdd�Zdd�Z	dd�Z
d	d
�ZdS)rFi cCs |j�|j�\}}||jf|fSr")r6Zrecvfrom�max_packet_size)r�dataZclient_addrrrrr<szUDPServer.get_requestcC�dSr"rr#rrrr$�zUDPServer.server_activatecCs|�|�dSr"rHrJrrrrBszUDPServer.shutdown_requestcCrfr"rrJrrrrIrgzUDPServer.close_requestN)rUrVrWr]r6Z
SOCK_DGRAMrZrdr<r$rBrIrrrrrsrcsTeZdZ	dZdZdZdZdd�dd�Zd	d
�Zdd�Z	d
d�Z
�fdd�Z�ZS)ri,N�(TF��blockingc	Cs�	|jdurdSt|j�|jkr?zt�dd�\}}|j�|�Wnty.|j��Yn	ty6Yn	wt|j�|jks|j�	�D]0}z|rKdntj
}t�||�\}}|j�|�WqDtyl|j�|�YqDtytYqDwdS)N���r)�active_children�len�max_children�os�waitpid�discard�ChildProcessErrorr'r=�copy�WNOHANG)rrj�pid�_�flagsrrr�collect_children(s0
����zForkingMixIn.collect_childrencC�	|��dSr"�rxr#rrrr:K�zForkingMixIn.handle_timeoutcCryr"rzr#rrrr.Rr{zForkingMixIn.service_actionscCs�	t��}|r|jdurt�|_|j�|�|�|�dSd}z/z
|�||�d}Wnty9|�||�YnwWz
|�	|�Wt�
|�dSt�
|�wz|�	|�Wt�
|�wt�
|�w)Nr\r)ror
rlr/�addrIrFr@rArB�_exit)rrDrEruZstatusrrrr?Ys,

���zForkingMixIn.process_requestcst���|j|jd�dS)Nri)�superrGrx�block_on_closer#��	__class__rrrGrs
zForkingMixIn.server_close)
rUrVrWr7rlrnrrxr:r.r?rG�
__classcell__rrr�rrs#rcs6eZdZ	�fdd�Zdd�Zdd�Zdd�Z�ZS)	�_Threadscs"|��|jr	dSt��|�dSr")�reap�daemonr~�append�r�threadr�rrr�{sz_Threads.appendcCsg|dd�|dd�<}|Sr"r)r�resultrrr�pop_all�sz_Threads.pop_allcCs|��D]}|��qdSr")r��joinr�rrrr��s
�z
_Threads.joincCsdd�|D�|dd�<dS)Ncss�|]	}|��r|VqdSr")Zis_alive)�.0r�rrr�	<genexpr>�s�z _Threads.reap.<locals>.<genexpr>rr#rrrr���z
_Threads.reap)rUrVrWr�r�r�r�r�rrr�rr�wsr�c@�eZdZ	dd�Zdd�ZdS)�
_NoThreadscCrfr"rr�rrrr��rRz_NoThreads.appendcCrfr"rr#rrrr��rRz_NoThreads.joinN)rUrVrWr�r�rrrrr��sr�cs<eZdZ	dZdZe�Zdd�Zdd�Z�fdd�Z	�Z
S)	rFTc	Cs`	z(z|�||�Wnty|�||�Yn	wW|�|�dSW|�|�dS|�|�wr")rFr@rArBrCrrr�process_request_thread�s���z%ThreadingMixIn.process_request_threadcCsN	|jr
t|��dt��tj|j||fd�}|j|_|j	�
|�|��dS)N�_threads)�targetrS)r�vars�
setdefaultr�rZThreadr��daemon_threadsr�r�r��start)rrDrE�trrrr?�s�zThreadingMixIn.process_requestcst���|j��dSr")r~rGr�r�r#r�rrrG�s
zThreadingMixIn.server_close)rUrVrWr�rr�r�r�r?rGr�rrr�rr�s

rc@�eZdZdS)rN�rUrVrWrrrrr��rc@r�)rNr�rrrrr�r�rc@r�)rNr�rrrrr�r�rc@r�)rNr�rrrrr�r�rc@�eZdZejZdS)rN�rUrVrWr6rrYrrrrr��
rc@r�)rNr�rrrrr�r�rc@r�)rNr�rrrrr�r�rc@r�)rNr�rrrrr�r�rc@�.eZdZ	dd�Zdd�Zdd�Zdd�Zd	S)
r	cCs<||_||_||_|��z|��W|��dS|��wr")rDrE�server�setup�handle�finish)rrDrEr�rrrr �s
zBaseRequestHandler.__init__cCrfr"rr#rrrr��rRzBaseRequestHandler.setupcCrfr"rr#rrrr��rRzBaseRequestHandler.handlecCrfr"rr#rrrr��rRzBaseRequestHandler.finishN)rUrVrWr r�r�r�rrrrr	�s
r	c@s.eZdZ	dZdZdZdZdd�Zdd�ZdS)	r
rkrNFcCs||j|_|jdur|j�|j�|jr|j�tjtjd�|j�	d|j
�|_|jdkr3t
|j�|_dS|j�	d|j�|_dS)NT�rbr�wb)rDZ
connectionr7Z
settimeout�disable_nagle_algorithmr^r6ZIPPROTO_TCPZTCP_NODELAYZmakefile�rbufsize�rfile�wbufsize�
_SocketWriter�wfiler#rrrr�s

�
zStreamRequestHandler.setupcCsD|jjsz|j��Wn
tjyYnw|j��|j��dSr")r��closed�flushr6�errorr`r�r#rrrr�#s�
zStreamRequestHandler.finish)	rUrVrWr�r�r7r�r�r�rrrrr
s	
r
c@r�)
r�cCs
||_dSr")�_sock)rZsockrrrr 3�
z_SocketWriter.__init__cCsdSr3rr#rrr�writable6rRz_SocketWriter.writablecCs>|j�|�t|��}|jWd�S1swYdSr")r�Zsendall�
memoryview�nbytes)r�bZviewrrr�write9s
$�z_SocketWriter.writecCs
|j��Sr")r�rbr#rrrrb>r�z_SocketWriter.filenoN)rUrVrWr r�r�rbrrrrr�.sr�c@r�)rcCs2ddlm}|j\|_|_||j�|_|�|_dS)Nr)�BytesIO)�ior�rDZpacketr6r�r�)rr�rrrr�EszDatagramRequestHandler.setupcCs|j�|j��|j�dSr")r6Zsendtor��getvaluerEr#rrrr�Kr�zDatagramRequestHandler.finishN)rUrVrWr�r�rrrrrAsr)$�__version__r6r*rorMrr�rr9r�__all__�hasattr�extendrr(ZSelectSelectorrrrr�listr�r�rrrrrrrrrr	r
r�rrrrr�<module>sPz


n~
X
(
.-

?>