AlkantarClanX12

Your IP : 3.16.75.156


Current Path : /opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/__pycache__/socketserver.cpython-37.opt-2.pyc

B

YI~d+i�	@s�dZddlZddlZddlZddlZddlZddlmZddlm	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
�d
�Zeed��r,Gdd�dee�ZGdd�dee�ZGdd�dee�ZGd d	�d	ee�Zeed��r�Gd!d�de�ZGd"d�de�ZGd#d�dee�ZGd$d�dee�ZGd%d
�d
�ZGd&d�de�ZGd'd(�d(e�ZGd)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�1/opt/alt/python37/lib64/python3.7/socketserver.py�__init__�s
zBaseServer.__init__cCsdS)Nr)rrrr�server_activate�szBaseServer.server_activate��?c	Csx|j��zVt��F}|�|tj�x0|jsR|�|�}|jr<P|rH|��|�	�q$WWdQRXWdd|_|j�
�XdS)NF)r�clear�_ServerSelector�register�	selectors�
EVENT_READr�select�_handle_request_noblock�service_actions�set)rZ
poll_interval�selector�readyrrr�
serve_forever�s

zBaseServer.serve_forevercCsd|_|j��dS)NT)rr�wait)rrrr�shutdown�szBaseServer.shutdowncCsdS)Nr)rrrrr)�szBaseServer.service_actionsc	Cs�|j��}|dkr|j}n|jdk	r0t||j�}|dk	rBt�|}t��R}|�|tj�x<|�	|�}|rp|�
�S|dk	rZ|t�}|dkrZ|��SqZWWdQRXdS)Nr)�socketZ
gettimeout�timeout�min�timer#r$r%r&r'r(�handle_timeout)rr1Zdeadliner+r,rrr�handle_requests"




zBaseServer.handle_requestcCs�y|��\}}Wntk
r$dSX|�||�r�y|�||�Wq�tk
rl|�||�|�|�Yq�|�|��Yq�Xn
|�|�dS)N)�get_request�OSError�verify_request�process_request�	Exception�handle_error�shutdown_request)r�request�client_addressrrrr(/s

z"BaseServer._handle_request_noblockcCsdS)Nr)rrrrr4FszBaseServer.handle_timeoutcCsdS)NTr)rr=r>rrrr8MszBaseServer.verify_requestcCs|�||�|�|�dS)N)�finish_requestr<)rr=r>rrrr9UszBaseServer.process_requestcCsdS)Nr)rrrr�server_close^szBaseServer.server_closecCs|�|||�dS)N)r)rr=r>rrrr?fszBaseServer.finish_requestcCs|�|�dS)N)�
close_request)rr=rrrr<jszBaseServer.shutdown_requestcCsdS)Nr)rr=rrrrAnszBaseServer.close_requestcCs@tdtjd�td|tjd�ddl}|��tdtjd�dS)Nz(----------------------------------------)�filez4Exception happened during processing of request fromr)�print�sys�stderr�	traceback�	print_exc)rr=r>rFrrrr;rszBaseServer.handle_errorcCs|S)Nr)rrrr�	__enter__szBaseServer.__enter__cGs|��dS)N)r@)r�argsrrr�__exit__�szBaseServer.__exit__)r!)�__name__�
__module__�__qualname__r1rr r-r/r)r5r(r4r8r9r@r?r<rAr;rHrJrrrrr�s$-

	
c@sbeZdZejZejZdZdZ	ddd�Z
dd�Zdd	�Zd
d�Z
dd
�Zdd�Zdd�Zdd�ZdS)r�FTcCsTt�|||�t�|j|j�|_|rPy|��|��Wn|���YnXdS)N)rrr0�address_family�socket_type�server_bindr r@)rrrZbind_and_activaterrrr�s
zTCPServer.__init__cCs8|jr|j�tjtjd�|j�|j�|j��|_dS)N�)�allow_reuse_addressr0�
setsockoptZ
SOL_SOCKETZSO_REUSEADDRZbindrZgetsockname)rrrrrQ�szTCPServer.server_bindcCs|j�|j�dS)N)r0Zlisten�request_queue_size)rrrrr �szTCPServer.server_activatecCs|j��dS)N)r0�close)rrrrr@�szTCPServer.server_closecCs
|j��S)N)r0�fileno)rrrrrW�szTCPServer.filenocCs
|j��S)N)r0Zaccept)rrrrr6�szTCPServer.get_requestcCs4y|�tj�Wntk
r$YnX|�|�dS)N)r/r0ZSHUT_WRr7rA)rr=rrrr<�s
zTCPServer.shutdown_requestcCs|��dS)N)rV)rr=rrrrA�szTCPServer.close_requestN)T)rKrLrMr0ZAF_INETrOZSOCK_STREAMrPrUrSrrQr r@rWr6r<rArrrrr�s/


c@s:eZdZdZejZdZdd�Zdd�Z	dd�Z
d	d
�ZdS)rFi cCs |j�|j�\}}||jf|fS)N)r0Zrecvfrom�max_packet_size)r�dataZclient_addrrrrr6szUDPServer.get_requestcCsdS)Nr)rrrrr szUDPServer.server_activatecCs|�|�dS)N)rA)rr=rrrr<szUDPServer.shutdown_requestcCsdS)Nr)rr=rrrrAszUDPServer.close_requestN)rKrLrMrSr0Z
SOCK_DGRAMrPrXr6r r<rArrrrrscsReZdZdZdZdZdZdd�dd�Zd	d
�Zdd�Z	d
d�Z
�fdd�Z�ZS)ri,N�(TF)�blockingc	Cs�|jdkrdSxht|j�|jkrvy t�dd�\}}|j�|�Wqtk
r^|j��Yqtk
rrPYqXqWxt|j�	�D]f}y.|r�dntj
}t�||�\}}|j�|�Wq�tk
r�|j�|�Yq�tk
r�Yq�Xq�WdS)N���r)�active_children�len�max_children�os�waitpid�discard�ChildProcessErrorr"r7�copy�WNOHANG)rr[�pid�_�flagsrrr�collect_children(s&
zForkingMixIn.collect_childrencCs|��dS)N)ri)rrrrr4KszForkingMixIn.handle_timeoutcCs|��dS)N)ri)rrrrr)RszForkingMixIn.service_actionscCs�t��}|r8|jdkrt�|_|j�|�|�|�dSd}z:y|�||�d}Wn tk
rr|�||�YnXWdz|�	|�Wdt�
|�XXdS)NrRr)r`r
r]r*�addrAr?r:r;r<�_exit)rr=r>rf�statusrrrr9Ys 

zForkingMixIn.process_requestcst���|j|jd�dS)N)r[)�superr@ri�block_on_close)r)�	__class__rrr@rs
zForkingMixIn.server_close)
rKrLrMr1r]r_rnrir4r)r9r@�
__classcell__rr)rorrs#cs8eZdZdZdZdZdd�Zdd�Z�fdd	�Z�Z	S)
rFTNc	CsHz6y|�||�Wn tk
r2|�||�YnXWd|�|�XdS)N)r?r:r;r<)rr=r>rrr�process_request_thread�s
z%ThreadingMixIn.process_request_threadcCsPtj|j||fd�}|j|_|jsD|jrD|jdkr8g|_|j�|�|��dS)N)�targetrI)	rZThreadrq�daemon_threadsZdaemonrn�_threads�append�start)rr=r>�trrrr9�s
zThreadingMixIn.process_requestcs:t���|jr6|j}d|_|r6x|D]}|��q&WdS)N)rmr@rnrt�join)rZthreadsZthread)rorrr@�s

zThreadingMixIn.server_close)
rKrLrMrsrnrtrqr9r@rprr)rorrws
c@seZdZdS)rN)rKrLrMrrrrr�sc@seZdZdS)rN)rKrLrMrrrrr�sc@seZdZdS)rN)rKrLrMrrrrr�sc@seZdZdS)rN)rKrLrMrrrrr�sc@seZdZejZdS)rN)rKrLrMr0rrOrrrrr�sc@seZdZejZdS)rN)rKrLrMr0rrOrrrrr�sc@seZdZdS)rN)rKrLrMrrrrr�sc@seZdZdS)rN)rKrLrMrrrrr�sc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r	cCs6||_||_||_|��z|��Wd|��XdS)N)r=r>�server�setup�handle�finish)rr=r>ryrrrr�szBaseRequestHandler.__init__cCsdS)Nr)rrrrrz�szBaseRequestHandler.setupcCsdS)Nr)rrrrr{�szBaseRequestHandler.handlecCsdS)Nr)rrrrr|�szBaseRequestHandler.finishN)rKrLrMrrzr{r|rrrrr	�s
c@s,eZdZdZdZdZdZdd�Zdd�ZdS)	r
r\rNFcCsz|j|_|jdk	r |j�|j�|jr:|j�tjtjd�|j�	d|j
�|_|jdkrdt
|j�|_n|j�	d|j�|_dS)NT�rbr�wb)r=Z
connectionr1Z
settimeout�disable_nagle_algorithmrTr0ZIPPROTO_TCPZTCP_NODELAYZmakefile�rbufsize�rfile�wbufsize�
_SocketWriter�wfile)rrrrrz�s



zStreamRequestHandler.setupcCsF|jjs.y|j��Wntjk
r,YnX|j��|j��dS)N)r��closed�flushr0�errorrVr�)rrrrr|s
zStreamRequestHandler.finish)	rKrLrMr�r�r1rrzr|rrrrr
�s
c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r�cCs
||_dS)N)�_sock)rZsockrrrrsz_SocketWriter.__init__cCsdS)NTr)rrrr�writablesz_SocketWriter.writablec	Cs&|j�|�t|��}|jSQRXdS)N)r�Zsendall�
memoryview�nbytes)r�bZviewrrr�writes
z_SocketWriter.writecCs
|j��S)N)r�rW)rrrrrW#sz_SocketWriter.filenoN)rKrLrMrr�r�rWrrrrr�sr�c@seZdZdd�Zdd�ZdS)rcCs2ddlm}|j\|_|_||j�|_|�|_dS)Nr)�BytesIO)�ior�r=Zpacketr0r�r�)rr�rrrrz*szDatagramRequestHandler.setupcCs|j�|j��|j�dS)N)r0Zsendtor��getvaluer>)rrrrr|0szDatagramRequestHandler.finishN)rKrLrMrzr|rrrrr&s)!�__version__r0r%r`rDrr�rr3r�__all__�hasattr�extendrr#ZSelectSelectorrrrrrrrrrrrrrr	r
r�rrrrr�<module>{sR


n~
X..-