Your IP : 3.145.170.164


Current Path : /lib64/python3.8/__pycache__/
Upload File :
Current File : //lib64/python3.8/__pycache__/socketserver.cpython-38.opt-2.pyc

U

e5d�j�	@sdZddlZddlZddlZddlZddlZddlmZddlm	Zddddd	d
ddd
g	Z
eed�rte
�dddg�eed�r�e
�ddddg�eed�r�ej
ZnejZGdd�d�ZGdd�de�ZGdd�de�Zeed�r�Gdd�d�ZGdd�de�ZGdd�d�ZGd d
�d
�Zeed��rJGd!d�dee�ZGd"d�dee�ZGd#d�dee�ZGd$d	�d	ee�Zeed��r�Gd%d�de�ZGd&d�de�ZGd'd�dee�ZGd(d�dee�ZGd)d
�d
�Z Gd*d�de �Z!Gd+d,�d,e�Z"Gd-d�de �Z#dS).z0.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�eZdZdZdd�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�$/usr/lib64/python3.8/socketserver.py�__init__�s
zBaseServer.__init__cCsdS�Nr�rrrr�server_activate�szBaseServer.server_activate��?c	Cst|j��zRt��B}|�|tj�|jsP|�|�}|jr:qP|rF|�	�|�
�q"W5QRXW5d|_|j��XdSr)r�clearr�set�_ServerSelector�register�	selectors�
EVENT_READ�select�_handle_request_noblock�service_actions)rZ
poll_interval�selector�readyrrr�
serve_forever�s

zBaseServer.serve_forevercCsd|_|j��dS�NT)rr�waitr"rrr�shutdown�szBaseServer.shutdowncCsdSr!rr"rrrr-�szBaseServer.service_actionsc
Cs�|j��}|dkr|j}n|jdk	r0t||j�}|dk	rBt�|}t��f}|�|tj�|�	|�}|rz|�
�W5QR�S|dk	rX|t�}|dkrX|��W5QR�SqXW5QRXdS)Nr)�socketZ
gettimeout�timeout�min�timer'r(r)r*r+r,�handle_timeout)rr5Zdeadliner.r/rrr�handle_requests 




zBaseServer.handle_requestcCs�z|��\}}Wntk
r&YdSX|�||�r�z|�||�Wq�tk
rn|�||�|�|�Yq�|�|��Yq�Xn
|�|�dSr!)�get_request�OSError�verify_request�process_request�	Exception�handle_error�shutdown_request�r�request�client_addressrrrr,/s

z"BaseServer._handle_request_noblockcCsdSr!rr"rrrr8FszBaseServer.handle_timeoutcCsdSr1rrArrrr<MszBaseServer.verify_requestcCs|�||�|�|�dSr!)�finish_requestr@rArrrr=UszBaseServer.process_requestcCsdSr!rr"rrr�server_close^szBaseServer.server_closecCs|�|||�dSr!)rrArrrrDfszBaseServer.finish_requestcCs|�|�dSr!��
close_request�rrBrrrr@jszBaseServer.shutdown_requestcCsdSr!rrHrrrrGnszBaseServer.close_requestcCs@tdtjd�td|tjd�ddl}|��tdtjd�dS)Nz(----------------------------------------)�filez4Exception happened during processing of request fromr)�print�sys�stderr�	traceback�	print_exc)rrBrCrMrrrr?rs�zBaseServer.handle_errorcCs|Sr!rr"rrr�	__enter__szBaseServer.__enter__cGs|��dSr!)rE)r�argsrrr�__exit__�szBaseServer.__exit__)r$)�__name__�
__module__�__qualname__r5r r#r0r3r-r9r,r8r<r=rErDr@rGr?rOrQrrrrr�s$-

	
c@sbeZdZejZejZdZdZ	ddd�Z
dd�Zdd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�ZdS)r�FTcCsTt�|||�t�|j|j�|_|rPz|��|��Wn|���YnXdSr!)rr r4�address_family�socket_type�server_bindr#rE)rrrZbind_and_activaterrrr �s�zTCPServer.__init__cCs8|jr|j�tjtjd�|j�|j�|j��|_dS)N�)�allow_reuse_addressr4�
setsockoptZ
SOL_SOCKETZSO_REUSEADDRZbindrZgetsocknamer"rrrrX�szTCPServer.server_bindcCs|j�|j�dSr!)r4Zlisten�request_queue_sizer"rrrr#�szTCPServer.server_activatecCs|j��dSr!)r4�closer"rrrrE�szTCPServer.server_closecCs
|j��Sr!)r4�filenor"rrrr^�szTCPServer.filenocCs
|j��Sr!)r4Zacceptr"rrrr:�szTCPServer.get_requestcCs4z|�tj�Wntk
r$YnX|�|�dSr!)r3r4ZSHUT_WRr;rGrHrrrr@�s
zTCPServer.shutdown_requestcCs|��dSr!)r]rHrrrrG�szTCPServer.close_requestN)T)rRrSrTr4ZAF_INETrVZSOCK_STREAMrWr\rZr rXr#rEr^r:r@rGrrrrr�s/


c@s:eZdZdZejZdZdd�Zdd�Z	dd�Z
d	d
�ZdS)rFi cCs |j�|j�\}}||jf|fSr!)r4Zrecvfrom�max_packet_size)r�dataZclient_addrrrrr:szUDPServer.get_requestcCsdSr!rr"rrrr#szUDPServer.server_activatecCs|�|�dSr!rFrHrrrr@szUDPServer.shutdown_requestcCsdSr!rrHrrrrGszUDPServer.close_requestN)rRrSrTrZr4Z
SOCK_DGRAMrWr_r:r#r@rGrrrrrscsReZdZdZdZdZdZdd�dd�Zd	d
�Zdd�Z	d
d�Z
�fdd�Z�ZS)ri,N�(TF��blockingc	Cs�|jdkrdSt|j�|jkrvz t�dd�\}}|j�|�Wqtk
r\|j��Yqtk
rrYqvYqXq|j�	�D]f}z.|r�dntj
}t�||�\}}|j�|�Wq�tk
r�|j�|�Yq�tk
r�Yq�Xq�dS)N���r)�active_children�len�max_children�os�waitpid�discard�ChildProcessErrorr%r;�copy�WNOHANG)rrc�pid�_�flagsrrr�collect_children(s&
zForkingMixIn.collect_childrencCs|��dSr!�rqr"rrrr8KszForkingMixIn.handle_timeoutcCs|��dSr!rrr"rrrr-RszForkingMixIn.service_actionscCs�t��}|r8|jdkrt�|_|j�|�|�|�dSd}z:z|�||�d}Wn t	k
rr|�
||�YnXW5z|�|�W5t�|�XXdS)NrYr)rhr
rer&�addrG�_exitr@rDr>r?)rrBrCrnZstatusrrrr=Ys 

zForkingMixIn.process_requestcst���|j|jd�dS)Nrb)�superrErq�block_on_closer"��	__class__rrrErs
zForkingMixIn.server_close)
rRrSrTr5rergrvrqr8r-r=rE�
__classcell__rrrwrrs#cs4eZdZ�fdd�Zdd�Zdd�Zdd�Z�ZS)	�_Threadscs"|��|jrdSt��|�dSr!)�reap�daemonru�append�r�threadrwrrr}{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)�.0rrrr�	<genexpr>�sz _Threads.reap.<locals>.<genexpr>rr"rrrr{�sz
_Threads.reap)rRrSrTr}r�r�r{ryrrrwrrzwsrzc@seZdZdd�Zdd�ZdS)�
_NoThreadscCsdSr!rr~rrrr}�sz_NoThreads.appendcCsdSr!rr"rrrr��sz_NoThreads.joinN)rRrSrTr}r�rrrrr��sr�cs:eZdZdZdZe�Zdd�Zdd�Z�fdd�Z	�Z
S)	rFTc	CsHz6z|�||�Wn tk
r2|�||�YnXW5|�|�XdSr!)r@rDr>r?rArrr�process_request_thread�s
z%ThreadingMixIn.process_request_threadcCsL|jrt|��dt��tj|j||fd�}|j|_|j	�
|�|��dS)N�_threads)�targetrP)rv�vars�
setdefaultrzrZThreadr��daemon_threadsr|r�r}�start)rrBrC�trrrr=�s�zThreadingMixIn.process_requestcst���|j��dSr!)rurEr�r�r"rwrrrE�s
zThreadingMixIn.server_close)rRrSrTr�rvr�r�r�r=rEryrrrwrr�s

c@seZdZdS)rN�rRrSrTrrrrr�sc@seZdZdS)rNr�rrrrr�sc@seZdZdS)rNr�rrrrr�sc@seZdZdS)rNr�rrrrr�sc@seZdZejZdS)rN�rRrSrTr4rrVrrrrr�sc@seZdZejZdS)rNr�rrrrr�sc@seZdZdS)rNr�rrrrr�sc@seZdZdS)rNr�rrrrr�sc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r	cCs6||_||_||_|��z|��W5|��XdSr!)rBrC�server�setup�finish�handle)rrBrCr�rrrr �szBaseRequestHandler.__init__cCsdSr!rr"rrrr��szBaseRequestHandler.setupcCsdSr!rr"rrrr��szBaseRequestHandler.handlecCsdSr!rr"rrrr��szBaseRequestHandler.finishN)rRrSrTr r�r�r�rrrrr	�s
c@s,eZdZdZdZdZdZdd�Zdd�ZdS)	r
rdrNFcCsz|j|_|jdk	r |j�|j�|jr:|j�tjtjd�|j�	d|j
�|_|jdkrdt
|j�|_n|j�	d|j�|_dS)NT�rbr�wb)rBZ
connectionr5Z
settimeout�disable_nagle_algorithmr[r4ZIPPROTO_TCPZTCP_NODELAYZmakefile�rbufsize�rfile�wbufsize�
_SocketWriter�wfiler"rrrr�s

�
zStreamRequestHandler.setupcCsF|jjs.z|j��Wntjk
r,YnX|j��|j��dSr!)r��closed�flushr4�errorr]r�r"rrrr�#s
zStreamRequestHandler.finish)	rRrSrTr�r�r5r�r�r�rrrrr
s
c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r�cCs
||_dSr!)�_sock)rZsockrrrr 3sz_SocketWriter.__init__cCsdSr1rr"rrr�writable6sz_SocketWriter.writablec
Cs2|j�|�t|��}|jW5QR�SQRXdSr!)r�Zsendall�
memoryview�nbytes)r�bZviewrrr�write9s
z_SocketWriter.writecCs
|j��Sr!)r�r^r"rrrr^>sz_SocketWriter.filenoN)rRrSrTr r�r�r^rrrrr�.sr�c@seZdZdd�Zdd�ZdS)rcCs2ddlm}|j\|_|_||j�|_|�|_dS)Nr)�BytesIO)�ior�rBZpacketr4r�r�)rr�rrrr�EszDatagramRequestHandler.setupcCs|j�|j��|j�dSr!)r4Zsendtor��getvaluerCr"rrrr�KszDatagramRequestHandler.finishN)rRrSrTr�r�rrrrrAs)$�__version__r4r)rhrKrr�rr7r�__all__�hasattr�extendrr'ZSelectSelectorrrrr�listrzr�rrrrrrrrrr	r
r�rrrrr�<module>{s`�

�
n~
X(.-

?>