Your IP : 3.12.146.108


Current Path : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/socketserver.cpython-311.opt-2.pyc

�

c��f�k��t�	dZddlZddlZddlZddlZddlZddlmZddlm	Zgd�Z
eed��re
�gd���eed��re
�gd	���eed
��rej
ZnejZGd�d��ZGd
�de��ZGd�de��Zeed��r
Gd�d��ZGd�de��ZGd�d��ZGd�d��Zeed��rGd�dee��ZGd�dee��ZGd�dee��ZGd�d ee��Zeed��r:Gd!�d"e��ZGd#�d$e��ZGd%�d&ee��ZGd'�d(ee��ZGd)�d*��Z Gd+�d,e ��Z!Gd-�d.e��Z"Gd/�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�|�eZdZ	dZd�Zd�Zdd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)rNc�b�	||_||_tj��|_d|_dS�NF)�server_address�RequestHandlerClass�	threading�Event�_BaseServer__is_shut_down�_BaseServer__shutdown_request)�selfrrs   �3/opt/alt/python311/lib64/python3.11/socketserver.py�__init__zBaseServer.__init__�s3��=�,���#6�� �'�o�/�/���"'�����c��	dS�N��r!s r"�server_activatezBaseServer.server_activate����	�
	
�r$��?c��	|j���	t��5}|�|tj��|jsN|�|��}|jrn1|r|���|�	��|j�Nddd��n#1swxYwYd|_|j�
��dS#d|_|j�
��wxYwr)r�clear�_ServerSelector�register�	selectors�
EVENT_READr �select�_handle_request_noblock�service_actions�set)r!�
poll_interval�selector�readys    r"�
serve_foreverzBaseServer.serve_forever�sJ��	�	
��!�!�#�#�#�	&�
!�"�"�
+�h��!�!�$�	�(<�=�=�=��1�+�$�O�O�M�:�:�E��.����7��4�4�6�6�6��(�(�*�*�*��1�+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+�
+����
+�
+�
+�
+�',�D�#���#�#�%�%�%�%�%��',�D�#���#�#�%�%�%�%���s/�C�A6B,� C�,B0�0C�3B0�4C�"C;c�H�	d|_|j���dS�NT)r r�waitr(s r"�shutdownzBaseServer.shutdown�s,��	�#'����� � �"�"�"�"�"r$c��	dSr&r'r(s r"r4zBaseServer.service_actions�r*r$c��	|j���}|�|j}n|j�t||j��}|�t	��|z}t��5}|�|tj��	|�	|��}|r |�
��cddd��S|�7|t	��z
}|dkr |���cddd��S�q#1swxYwYdS)NTr)�socket�
gettimeout�timeout�min�timer.r/r0r1r2r3�handle_timeout)r!rB�deadliner7r8s     r"�handle_requestzBaseServer.handle_requestsg��	��+�(�(�*�*���?��l�G�G�
�\�
%��'�4�<�0�0�G����v�v��'�H��
�
�	9�(����d�I�$8�9�9�9�
9� ����0�0���9��7�7�9�9�
	9�	9�	9�	9�	9�	9�	9�	9��*�"*�T�V�V�"3��"�Q�;�;�#'�#6�#6�#8�#8�	9�	9�	9�	9�	9�	9�	9�	9�
9�	9�	9�	9�	9����	9�	9�	9�	9�	9�	9s�"AC5�;,C5�4C5�5C9�<C9c��		|���\}}n#t$rYdSwxYw|�||��rk	|�||��dS#t$r/|�||��|�|��YdS|�|���xYw|�|��dSr&)�get_request�OSError�verify_request�process_request�	Exception�handle_error�shutdown_request�r!�request�client_addresss   r"r3z"BaseServer._handle_request_noblock0s���	�	�&*�&6�&6�&8�&8�#�G�^�^���	�	�	��F�F�	�������w��7�7�
	+�
��$�$�W�n�=�=�=�=�=���
/�
/�
/��!�!�'�>�:�:�:��%�%�g�.�.�.�.�.�.�
��%�%�g�.�.�.������!�!�'�*�*�*�*�*s��
)�)�A�5B*�B*c��	dSr&r'r(s r"rEzBaseServer.handle_timeoutGs��	�	
�r$c��	dSr;r'rPs   r"rKzBaseServer.verify_requestNs��	�
�tr$c�^�	|�||��|�|��dSr&)�finish_requestrOrPs   r"rLzBaseServer.process_requestVs9��	�
	
���G�^�4�4�4����g�&�&�&�&�&r$c��	dSr&r'r(s r"�server_closezBaseServer.server_close_r*r$c�6�	|�|||��dSr&)rrPs   r"rVzBaseServer.finish_requestgs#��F�� � ��.�$�?�?�?�?�?r$c�2�	|�|��dSr&��
close_request�r!rQs  r"rOzBaseServer.shutdown_requestks��A����7�#�#�#�#�#r$c��	dSr&r'r]s  r"r\zBaseServer.close_requestos
��7��r$c���	tdtj���td|tj���ddl}|���tdtj���dS)Nz(----------------------------------------)�filez4Exception occurred during processing of request fromr)�print�sys�stderr�	traceback�	print_exc)r!rQrRrds    r"rNzBaseServer.handle_errorssx��	�
	�f�3�:�&�&�&�&�
�D����	-�	-�	-�	-�����������
�f�3�:�&�&�&�&�&�&r$c��|Sr&r'r(s r"�	__enter__zBaseServer.__enter__�s���r$c�.�|���dSr&)rX)r!�argss  r"�__exit__zBaseServer.__exit__�s���������r$)r+)�__name__�
__module__�__qualname__rBr#r)r9r=r4rGr3rErKrLrXrVrOr\rNrgrjr'r$r"rr�s(������*�X�G�(�(�(�
�
�
�&�&�&�&�:#�#�#�
�
�
�&9�9�9�<+�+�+�.
�
�
����'�'�'�
�
�
�@�@�@�$�$�$�
�
�
�'�'�'��������r$rc�j�eZdZ	ejZejZdZdZ	dZ
d
d�Zd�Zd�Z
d�Zd�Zd	�Zd
�Zd�ZdS)r�FTc��	t�|||��tj|j|j��|_|rE	|���|���dS#|����xYwdSr&)rr#r@�address_family�socket_type�server_bindr)rX)r!rr�bind_and_activates    r"r#zTCPServer.__init__�s���=����D�.�2E�F�F�F��m�D�$7�$(�$4�6�6����	�
�� � �"�"�"��$�$�&�&�&�&�&��
��!�!�#�#�#�����
	�	s�(A/�/Bc��	|jrEttd��r0|j�tjtjd��|jrEttd��r0|j�tjtjd��|j�|j	��|j�
��|_	dS)N�SO_REUSEADDR��SO_REUSEPORT)�allow_reuse_address�hasattrr@�
setsockopt�
SOL_SOCKETrv�allow_reuse_portrx�bindr�getsocknamer(s r"rszTCPServer.server_bind�s���	�
�#�	N����(G�(G�	N��K�"�"�6�#4�f�6I�1�M�M�M�� �	N�W�V�^�%D�%D�	N��K�"�"�6�#4�f�6I�1�M�M�M������,�-�-�-�"�k�5�5�7�7����r$c�F�	|j�|j��dSr&)r@�listen�request_queue_sizer(s r"r)zTCPServer.server_activate�s(��	�
	
����4�2�3�3�3�3�3r$c�:�	|j���dSr&)r@�closer(s r"rXzTCPServer.server_close�s#��	�
	
��������r$c�6�	|j���Sr&)r@�filenor(s r"r�zTCPServer.fileno����	�
�{�!�!�#�#�#r$c�6�	|j���Sr&)r@�acceptr(s r"rIzTCPServer.get_request�r�r$c��		|�tj��n#t$rYnwxYw|�|��dSr&)r=r@�SHUT_WRrJr\r]s  r"rOzTCPServer.shutdown_request�s_��A�	�
���V�^�,�,�,�,���	�	�	��D�	�������7�#�#�#�#�#s�#�
0�0c�0�	|���dSr&)r�r]s  r"r\zTCPServer.close_requests��7��
�
�����r$N)T)rkrlrmr@�AF_INETrq�SOCK_STREAMrrr�ryr}r#rsr)rXr�rIrOr\r'r$r"rr�s�������,�\�^�N��$�K�����������8�8�8�4�4�4����$�$�$�$�$�$�$�$�$�����r$rc�B�eZdZ	dZdZejZdZd�Z	d�Z
d�Zd�ZdS)rFi c�\�|j�|j��\}}||jf|fSr&)r@�recvfrom�max_packet_size)r!�data�client_addrs   r"rIzUDPServer.get_requests1�� �K�0�0��1E�F�F���k��d�k�"�K�/�/r$c��dSr&r'r(s r"r)zUDPServer.server_activate����r$c�0�|�|��dSr&r[r]s  r"rOzUDPServer.shutdown_requests�����7�#�#�#�#�#r$c��dSr&r'r]s  r"r\zUDPServer.close_request"r�r$N)
rkrlrmryr}r@�
SOCK_DGRAMrrr�rIr)rOr\r'r$r"rr
sl������������#�K��O�0�0�0�
�
�
�$�$�$�
�
�
�
�
r$rc�N��eZdZ	dZdZdZdZdd�d�Zd�Zd	�Z	d
�Z
�fd�Z�xZS)ri,N�(TF��blockingc��	|j�dSt|j��|jkr�	tjdd��\}}|j�|��n4#t$r|j���Ynt$rYn!wxYwt|j��|jk��|j�	��D]z}	|rdntj
}tj||��\}}|j�|���F#t$r|j�|��Y�lt$rY�wwxYwdS)N���r)�active_children�len�max_children�os�waitpid�discard�ChildProcessErrorr-rJ�copy�WNOHANG)r!r��pid�_�flagss     r"�collect_childrenzForkingMixIn.collect_children0s���I��#�+����d�*�+�+�t�/@�@�@���Z��A�.�.�F�C���(�0�0��5�5�5�5��(�1�1�1��(�.�.�0�0�0�0�0������E������d�*�+�+�t�/@�@�@��+�0�0�2�2�
�
��
�!)�9�A�A�r�z�E��Z��U�3�3�F�C���(�0�0��5�5�5�5��(�6�6�6��(�0�0��5�5�5�5�5������D�����
�
s0�2A�#B
�	B
�B
�	AD�$D>�2	D>�=D>c�0�	|���dSr&�r�r(s r"rEzForkingMixIn.handle_timeoutS�!��
�
�!�!�#�#�#�#�#r$c�0�	|���dSr&r�r(s r"r4zForkingMixIn.service_actionsZr�r$c�b�	tj��}|rK|j�t��|_|j�|��|�|��dSd}	|�||��d}n&#t$r|�||��YnwxYw	|�	|��tj
|��dS#tj
|��wxYw#	|�	|��tj
|��w#tj
|��wxYwxYw)Nrwr)r�rr�r5�addr\rVrMrNrO�_exit)r!rQrRr��statuss     r"rLzForkingMixIn.process_requestasH��?��'�)�)�C��
)��'�/�+.�5�5�D�(��$�(�(��-�-�-��"�"�7�+�+�+�����	)��'�'���@�@�@��F�F�� �?�?�?��%�%�g�~�>�>�>�>�>�?����)��-�-�g�6�6�6����(�(�(�(�(�����(�(�(�(�����)��-�-�g�6�6�6����(�(�(�(�����(�(�(�(������sN�%A>�=C)�> B!�C)� B!�!C)�%C�C&�)D.�+D�D.�D+�+D.c�~��t�����|�|j���dS)Nr�)�superrXr��block_on_close�r!�	__class__s �r"rXzForkingMixIn.server_closezs9����G�G� � �"�"�"��!�!�4�+>�!�?�?�?�?�?r$)
rkrlrmrBr�r�r�r�rEr4rLrX�
__classcell__�r�s@r"rr's��������C���������/4�!	�!	�!	�!	�!	�F	$�	$�	$�	$�	$�	$�	)�	)�	)�2	@�	@�	@�	@�	@�	@�	@�	@�	@r$rc�2��eZdZ	�fd�Zd�Zd�Zd�Z�xZS)�_Threadsc���|���|jrdSt���|��dSr&)�reap�daemonr��append)r!�threadr�s  �r"r�z_Threads.append�s;����	�	�����=�	��F�
�����v�����r$c�*�g|dd�c|dd�<}|Sr&r')r!�results  r"�pop_allz_Threads.pop_all�s"���d�1�1�1�g���Q�Q�Q����
r$c�\�|���D]}|����dSr&)r��join�r!r�s  r"r�z
_Threads.join�s2���l�l�n�n�	�	�F��K�K�M�M�M�M�	�	r$c�(�d�|D��|dd�<dS)Nc3�BK�|]}|����|V��dSr&)�is_alive)�.0r�s  r"�	<genexpr>z _Threads.reap.<locals>.<genexpr>�s1����B�B�f����0A�0A�B�6�B�B�B�B�B�Br$r'r(s r"r�z
_Threads.reap�s!��B�B��B�B�B��Q�Q�Q���r$)rkrlrmr�r�r�r�r�r�s@r"r�r�sq�������������������C�C�C�C�C�C�Cr$r�c��eZdZ	d�Zd�ZdS)�
_NoThreadsc��dSr&r'r�s  r"r�z_NoThreads.append�����r$c��dSr&r'r(s r"r�z_NoThreads.join�r�r$N)rkrlrmr�r�r'r$r"r�r��s7�������
�
�
�
�
�
�
�
r$r�c�H��eZdZ	dZdZe��Zd�Zd�Z�fd�Z	�xZ
S)r
FTc���		|�||��n&#t$r|�||��YnwxYw|�|��dS#|�|��wxYwr&)rVrMrNrOrPs   r"�process_request_threadz%ThreadingMixIn.process_request_thread�s���	�
	+������8�8�8�8���	7�	7�	7����g�~�6�6�6�6�6�	7����
�!�!�'�*�*�*�*�*��D�!�!�'�*�*�*�*���s!��A� =�A�=�A�A.c�"�	|jr/t|���dt����t	j|j||f���}|j|_|j	�
|��|���dS)N�_threads)�targetri)r��vars�
setdefaultr�r�Threadr��daemon_threadsr�r�r��start)r!rQrR�ts    r"rLzThreadingMixIn.process_request�s���8���	:���J�J�!�!�*�h�j�j�9�9�9���d�&A�%,�n�$=�
?�
?�
?���&����
���Q����	���	�	�	�	�	r$c�z��t�����|j���dSr&)r�rXr�r�r�s �r"rXzThreadingMixIn.server_close�s3���
���������
�������r$)rkrlrmr�r�r�r�r�rLrXr�r�s@r"r
r
�sr�������>��N��N��z�|�|�H�+�+�+������������r$r
c��eZdZdS)rN�rkrlrmr'r$r"rr���������r$rc��eZdZdS)rNr�r'r$r"rr�r�r$rc��eZdZdS)rNr�r'r$r"rr�r�r$rc��eZdZdS)r	Nr�r'r$r"r	r	�r�r$r	c��eZdZejZdS)rN�rkrlrmr@rrqr'r$r"rr������������r$rc��eZdZejZdS)rNr�r'r$r"rr�r�r$rc��eZdZdS)rNr�r'r$r"rr�r�r$rc��eZdZdS)rNr�r'r$r"rr�r�r$rc�(�eZdZ	d�Zd�Zd�Zd�ZdS)r
c���||_||_||_|���	|���|���dS#|���wxYwr&)rQrR�server�setup�handle�finish)r!rQrRr�s    r"r#zBaseRequestHandler.__init__�sZ�����,�������
�
����	��K�K�M�M�M��K�K�M�M�M�M�M��D�K�K�M�M�M�M���s�A�A+c��dSr&r'r(s r"r�zBaseRequestHandler.setup�r�r$c��dSr&r'r(s r"r�zBaseRequestHandler.handle�r�r$c��dSr&r'r(s r"r�zBaseRequestHandler.finish�r�r$N)rkrlrmr#r�r�r�r'r$r"r
r
�sU������� ���
�
�
�
�
�
�
�
�
�
�
r$r
c�,�eZdZ	dZdZdZdZd�Zd�ZdS)rr�rNFc��|j|_|j�|j�|j��|jr0|j�tjtjd��|j�	d|j
��|_|jdkrt|j��|_dS|j�	d|j��|_dS)NT�rbr�wb)rQ�
connectionrB�
settimeout�disable_nagle_algorithmr{r@�IPPROTO_TCP�TCP_NODELAY�makefile�rbufsize�rfile�wbufsize�
_SocketWriter�wfiler(s r"r�zStreamRequestHandler.setups����,����<�#��O�&�&�t�|�4�4�4��'�	A��O�&�&�v�'9�'-�'9�4�
A�
A�
A��_�-�-�d�D�M�B�B��
��=�A���&�t��7�7�D�J�J�J���1�1�$��
�F�F�D�J�J�Jr$c���|jjs0	|j���n#tj$rYnwxYw|j���|j���dSr&)r�closed�flushr@�errorr�rr(s r"r�zStreamRequestHandler.finish+s���z� �	�
��
� � �"�"�"�"���<�
�
�
���
����	
�
�������
�������s�(�:�:)	rkrlrmr�rrBr�r�r�r'r$r"rr	sS������>��H��H��G�$��G�G�G�	�	�	�	�	r$rc�(�eZdZ	d�Zd�Zd�Zd�ZdS)rc��||_dSr&)�_sock)r!�socks  r"r#z_SocketWriter.__init__;s
����
�
�
r$c��dSr;r'r(s r"�writablez_SocketWriter.writable>s���tr$c��|j�|��t|��5}|jcddd��S#1swxYwYdSr&)r
�sendall�
memoryview�nbytes)r!�b�views   r"�writez_SocketWriter.writeAs����
���1����
��]�]�	�d��;�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�>�A�Ac�4�|j���Sr&)r
r�r(s r"r�z_SocketWriter.filenoFs���z� � �"�"�"r$N)rkrlrmr#r
rr�r'r$r"rr6sV������J����������
#�#�#�#�#r$rc��eZdZ	d�Zd�ZdS)rc��ddlm}|j\|_|_||j��|_|��|_dS)Nr)�BytesIO)�iorrQ�packetr@rr)r!rs  r"r�zDatagramRequestHandler.setupMsH��������#'�<� ���T�[��W�T�[�)�)��
��W�Y�Y��
�
�
r$c�t�|j�|j���|j��dSr&)r@�sendtor�getvaluerRr(s r"r�zDatagramRequestHandler.finishSs1������4�:�.�.�0�0�$�2E�F�F�F�F�Fr$N)rkrlrmr�r�r'r$r"rrIs:������@����G�G�G�G�Gr$r)$�__version__r@r0r�rbrrrrDr�__all__rz�extendrr.�SelectSelectorrrrr�listr�r�r
rrrr	rrrrr
rrrr'r$r"�<module>r#sZ��v�t���
�
�
�����	�	�	�	�
�
�
�
�����������"�"�"�"�"�"�7�7�7���7�2�v���L��N�N�J�J�J�K�K�K�
�7�6�9���4��N�N�3�3�3�4�4�4��7�9�n�%�%�/��,�O�O��.�O�k�k�k�k�k�k�k�k�\@�@�@�@�@�
�@�@�@�F
�
�
�
�
�	�
�
�
�8�7�2�v���V@�U@�U@�U@�U@�U@�U@�U@�U@�pC�C�C�C�C�t�C�C�C�,
�
�
�
�
�
�
�
�%�%�%�%�%�%�%�%�P�7�2�v���:�9�9�9�9�9�<��9�9�9�9�9�9�9�9�<��9�9�9�9�9�9�9�9���9�9�9�9�9�9�9�9���9�9�9�
�7�6�9���
P�(�(�(�(�(�9�(�(�(�(�(�(�(�(�Y�(�(�(�L�K�K�K�K�N�4D�K�K�K�O�O�O�O�O�n�6H�O�O�O�#
�#
�#
�#
�#
�#
�#
�#
�\+�+�+�+�+�-�+�+�+�Z#�#�#�#�#�N�#�#�#�&G�G�G�G�G�/�G�G�G�G�Gr$

?>