Your IP : 18.118.28.160


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/socketserver.cpython-312.opt-2.pyc

�

�Q�f�l��Z�	dZddlZddlZddlZddlZddlZddlmZddlm	Zgd�Z
eed�re
jgd��eed�r/e
jgd	��eed�re
jd
dg�eed�r
ejZnejZGd
�d�ZGd�de�ZGd�de�Zeed�r
Gd�d�ZGd�de�ZGd�d�ZGd�d�Zeed�rGd�dee�ZGd�dee�ZGd�d ee�ZGd!�d"ee�Zeed�rOGd#�d$e�ZGd%�d&e�ZGd'�d(ee�ZGd)�d*ee�Zeed�rGd+�d
ee�Z Gd,�dee�Z!Gd-�d.�Z"Gd/�d0e"�Z#Gd1�d2e�Z$Gd3�d4e"�Z%y)5z0.4�N)�BufferedIOBase)�	monotonic)	�
BaseServer�	TCPServer�	UDPServer�ThreadingUDPServer�ThreadingTCPServer�BaseRequestHandler�StreamRequestHandler�DatagramRequestHandler�ThreadingMixIn�fork)�ForkingUDPServer�ForkingTCPServer�ForkingMixIn�AF_UNIX)�UnixStreamServer�UnixDatagramServer�ThreadingUnixStreamServer�ThreadingUnixDatagramServer�ForkingUnixStreamServer�ForkingUnixDatagramServer�PollSelectorc�z�eZdZ	dZd�Zd�Zdd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zy)rNc�b�	||_||_tj�|_d|_y�NF)�server_address�RequestHandlerClass�	threading�Event�_BaseServer__is_shut_down�_BaseServer__shutdown_request)�selfrrs   �3/opt/alt/python312/lib64/python3.12/socketserver.py�__init__zBaseServer.__init__�s,��=�,���#6�� �'�o�o�/���"'���c��	y�N��r#s r$�server_activatezBaseServer.server_activate����	�
	
r&c��	|jj�	t�5}|j|tj
�|jsM|j|�}|jrn/|r|j�|j�|js�Mddd�d|_|jj�y#1swY�+xYw#d|_|jj�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�s���	�	
���!�!�#�	&�
!�"�h��!�!�$�	�(<�(<�=��1�1�$�O�O�M�:�E��.�.����4�4�6��(�(�*��1�1�#�',�D�#����#�#�%�#�"��',�D�#����#�#�%�s#�
C�A9C�!C�C�C�#C:c�H�	d|_|jj�y�NT)r"r!�waitr*s r$�shutdownzBaseServer.shutdown�s#��	�#'������ � �"r&c��	yr(r)r*s r$r5zBaseServer.service_actionsr,r&c���	|jj�}|�
|j}n"|j�t||j�}|�
t	�|z}t�5}|j
|tj�	|j|�r|j�cddd�S|�+t	�z
}|dkr|j�cddd�S�X#1swYyxYw)Nr)�socket�
gettimeout�timeout�min�timer/r0r1r2r3r4�handle_timeout)r#rC�deadliner8s    r$�handle_requestzBaseServer.handle_requests���	��+�+�(�(�*���?��l�l�G�
�\�\�
%��'�4�<�<�0�G����v��'�H��
�(����d�I�$8�$8�9���?�?�7�+��7�7�9�
	9�
	9��*�"*�T�V�"3��"�Q�;�#'�#6�#6�#8�
	9�
	9���
�s�&AC �2#C �C � C)c�B�		|j�\}}|j||�r	|j||�y|j
|�y#t$rYywxYw#t$r&|j||�|j
|�Yy|j
|��xYwr()�get_request�OSError�verify_request�process_request�	Exception�handle_error�shutdown_request�r#�request�client_addresss   r$r4z"BaseServer._handle_request_noblock1s���	�	�&*�&6�&6�&8�#�G�^����w��7�
��$�$�W�n�=�
�!�!�'�*���	��	��
�
/��!�!�'�>�:��%�%�g�.�
��%�%�g�.��s"�A�A�	A�A�,B�Bc��	yr(r)r*s r$rFzBaseServer.handle_timeoutHs��	�	
r&c��	yr<r)rQs   r$rLzBaseServer.verify_requestOs��	�
r&c�L�	|j||�|j|�yr()�finish_requestrPrQs   r$rMzBaseServer.process_requestWs'��	�
	
���G�^�4����g�&r&c��	yr(r)r*s r$�server_closezBaseServer.server_close`r,r&c�,�	|j|||�yr()rrQs   r$rWzBaseServer.finish_requesths��F�� � ��.�$�?r&c�(�	|j|�yr(��
close_request�r#rRs  r$rPzBaseServer.shutdown_requestls��A����7�#r&c��	yr(r)r^s  r$r]zBaseServer.close_requestps��7�r&c���	tdtj��td|tj��ddl}|j	�tdtj��y)Nz(----------------------------------------)�filez4Exception occurred during processing of request fromr)�print�sys�stderr�	traceback�	print_exc)r#rRrSres    r$rOzBaseServer.handle_errortsH��	�
	�f�3�:�:�&�
�D�����	-������
�f�3�:�:�&r&c��|Sr(r)r*s r$�	__enter__zBaseServer.__enter__�s���r&c�$�|j�yr()rY)r#�argss  r$�__exit__zBaseServer.__exit__�s�����r&)g�?)�__name__�
__module__�__qualname__rCr%r+r:r>r5rHr4rFrLrMrYrWrPr]rOrhrkr)r&r$rr�se��*�X�G�(�
�&�:#�
�&9�:+�.
��'�
�@�$�
�'��r&rc�|�eZdZ	ejZejZdZdZ	dZ
dd�Zd�Zd�Z
d�Zd�Zd�Zd	�Zd
�Zy)
r�Fc��	tj|||�tj|j|j�|_|r"	|j�|j
�yy#|j��xYwr()rr%rA�address_family�socket_type�server_bindr+rY)r#rr�bind_and_activates    r$r%zTCPServer.__init__�st��=����D�.�2E�F��m�m�D�$7�$7�$(�$4�$4�6����
�� � �"��$�$�&���
��!�!�#��s� A-�-Bc���	|jrIttd�r9|jjtjtj
d�|jrIttd�r9|jjtjtjd�|jj|j�|jj�|_	y)N�SO_REUSEADDR��SO_REUSEPORT)�allow_reuse_address�hasattrrA�
setsockopt�
SOL_SOCKETrw�allow_reuse_portry�bindr�getsocknamer*s r$rtzTCPServer.server_bind�s���	�
�#�#����(G��K�K�"�"�6�#4�#4�f�6I�6I�1�M�� � �W�V�^�%D��K�K�"�"�6�#4�#4�f�6I�6I�1�M�������,�,�-�"�k�k�5�5�7��r&c�P�	|jj|j�yr()rA�listen�request_queue_sizer*s r$r+zTCPServer.server_activate�s!��	�
	
�����4�2�2�3r&c�:�	|jj�yr()rA�closer*s r$rYzTCPServer.server_close�s��	�
	
�����r&c�8�	|jj�Sr()rA�filenor*s r$r�zTCPServer.fileno����	�
�{�{�!�!�#�#r&c�8�	|jj�Sr()rA�acceptr*s r$rJzTCPServer.get_request�r�r&c��		|jtj�|j	|�y#t$rY�wxYwr()r>rA�SHUT_WRrKr]r^s  r$rPzTCPServer.shutdown_request�sB��A�	�
���V�^�^�,�	
���7�#���	��	�s�4�	A�Ac�&�	|j�yr()r�r^s  r$r]zTCPServer.close_requests��7��
�
�r&N)T)rlrmrnrA�AF_INETrr�SOCK_STREAMrsr�rzr~r%rtr+rYr�rJrPr]r)r&r$rr�sX��,�\�^�^�N��$�$�K��������8�4��$�$�$�r&rc�J�eZdZ	dZdZejZdZd�Z	d�Z
d�Zd�Zy)rFi c�r�|jj|j�\}}||jf|fSr()rA�recvfrom�max_packet_size)r#�data�client_addrs   r$rJzUDPServer.get_requests5�� �K�K�0�0��1E�1E�F���k��d�k�k�"�K�/�/r&c��yr(r)r*s r$r+zUDPServer.server_activate���r&c�&�|j|�yr(r\r^s  r$rPzUDPServer.shutdown_requests�����7�#r&c��yr(r)r^s  r$r]zUDPServer.close_request#r�r&N)
rlrmrnrzr~rA�
SOCK_DGRAMrsr�rJr+rPr]r)r&r$rrs5��������#�#�K��O�0�
�$�
r&rc�N��eZdZ	dZdZdZdZdd�d�Zd�Zd	�Z	d
�Z
�fd�Z�xZS)ri,N�(TF��blockingc��	|j�yt|j�|jk\rX	tjdd�\}}|jj|�t|j�|jk\r�X|jj�D]K}	|rdntj}tj||�\}}|jj|��My#t$r|jj�Y��t$rY��wxYw#t$r|jj|�Y��t$rY��wxYw)N���r)�active_children�len�max_children�os�waitpid�discard�ChildProcessErrorr.rK�copy�WNOHANG)r#r��pid�_�flagss     r$�collect_childrenzForkingMixIn.collect_children1s+��I��#�#�+���d�*�*�+�t�/@�/@�@���Z�Z��A�.�F�C���(�(�0�0��5��d�*�*�+�t�/@�/@�@��+�+�0�0�2��
�!)�A�r�z�z�E��Z�Z��U�3�F�C���(�(�0�0��5�
3��)�1��(�(�.�.�0������)�6��(�(�0�0��5�����s0�4C2�'AD%�2#D"�D"�!D"�%$E�E�Ec�&�	|j�yr(�r�r*s r$rFzForkingMixIn.handle_timeoutT���
�
�!�!�#r&c�&�	|j�yr(r�r*s r$r5zForkingMixIn.service_actions[r�r&c�@�	tj�}|rH|j�t�|_|jj	|�|j|�yd}	|j
||�d}	|j|�tj|�y#t$r|j||�Y�EwxYw#tj|�wxYw#	|j|�tj|�w#tj|�wxYwxYw)Nrxr)r�rr�r6�addr]rWrNrOrP�_exit)r#rRrSr��statuss     r$rMzForkingMixIn.process_requestbs���?��'�'�)�C���'�'�/�+.�5�D�(��$�$�(�(��-��"�"�7�+����	)��'�'���@��F�)��-�-�g�6�����(��
!�?��%�%�g�~�>�?������(��)��-�-�g�6�����(������(�sH�#B�8C�B=�:C�<B=�=C�C�D�D�-D�D�Dc�Z��t�|��|j|j��y)Nr�)�superrYr��block_on_close�r#�	__class__s �r$rYzForkingMixIn.server_close{s%����G� �"��!�!�4�+>�+>�!�?r&)
rlrmrnrCr�r�r�r�rFr5rMrY�
__classcell__�r�s@r$rr(s>���C���������/4�!	�F	$�	$�	)�2	@�	@r&rc�2��eZdZ	�fd�Zd�Zd�Zd�Z�xZS)�_Threadsc�^��|j�|jryt�|�
|�yr()�reap�daemonr��append)r#�threadr�s  �r$r�z_Threads.append�s"����	�	���=�=��
���v�r&c��g|ddc|dd}|Sr(r))r#�results  r$�pop_allz_Threads.pop_all�s���d�1�g���Q����
r&c�N�|j�D]}|j��yr()r��join�r#r�s  r$r�z
_Threads.join�s���l�l�n�F��K�K�M�%r&c��d�|D�|ddy)Nc3�BK�|]}|j�s�|���y�wr()�is_alive)�.0r�s  r$�	<genexpr>z _Threads.reap.<locals>.<genexpr>�s����B��f����0A�6��s��r)r*s r$r�z
_Threads.reap�s��B��B��Q�r&)rlrmrnr�r�r�r�r�r�s@r$r�r��s�������Cr&r�c��eZdZ	d�Zd�Zy)�
_NoThreadsc��yr(r)r�s  r$r�z_NoThreads.append����r&c��yr(r)r*s r$r�z_NoThreads.join�r�r&N)rlrmrnr�r�r)r&r$r�r��s���
�
r&r�c�B��eZdZ	dZdZe�Zd�Zd�Z�fd�Z	�xZ
S)r
FTc��		|j||�|j|�y#t$r|j||�Y�/wxYw#|j|�wxYwr()rWrNrOrPrQs   r$�process_request_threadz%ThreadingMixIn.process_request_thread�s^��	�
	+������8�
�!�!�'�*���	7����g�~�6�	7��
�!�!�'�*�s!�'�A�A�A�A�Ac�"�	|jr#t|�jdt��t	j
|j||f��}|j|_|jj|�|j�y)N�_threads)�targetrj)r��vars�
setdefaultr�r�Threadr��daemon_threadsr�r�r��start)r#rRrS�ts    r$rMzThreadingMixIn.process_request�sl��8������J�!�!�*�h�j�9����d�&A�&A�%,�n�$=�
?���&�&����
�
���Q��	���	r&c�V��t�|��|jj�yr()r�rYr�r�r�s �r$rYzThreadingMixIn.server_close�s���
�����
�
���r&)rlrmrnr�r�r�r�r�rMrYr�r�s@r$r
r
�s/���>��N��N��|�H�+���r&r
c��eZdZy)rN�rlrmrnr)r&r$rr���r&rc��eZdZy)rNr�r)r&r$rr�r�r&rc��eZdZy)rNr�r)r&r$rr�r�r&rc��eZdZy)r	Nr�r)r&r$r	r	�r�r&r	c�$�eZdZejZy)rN�rlrmrnrArrrr)r&r$rr�������r&rc�$�eZdZejZy)rNr�r)r&r$rr�r�r&rc��eZdZy)rNr�r)r&r$rr�r�r&rc��eZdZy)rNr�r)r&r$rr�r�r&rc��eZdZy)rNr�r)r&r$rr�r�r&c��eZdZy)rNr�r)r&r$rr�r�r&c�&�eZdZ	d�Zd�Zd�Zd�Zy)r
c��||_||_||_|j�	|j	�|j�y#|j�wxYwr()rRrS�server�setup�handle�finish)r#rRrSr�s    r$r%zBaseRequestHandler.__init__�sB�����,�������
�
��	��K�K�M��K�K�M��D�K�K�M�s�A�Ac��yr(r)r*s r$r�zBaseRequestHandler.setup�r�r&c��yr(r)r*s r$r�zBaseRequestHandler.handler�r&c��yr(r)r*s r$r�zBaseRequestHandler.finishr�r&N)rlrmrnr%r�r�r�r)r&r$r
r
�s��� �
�
�
r&r
c�*�eZdZ	dZdZdZdZd�Zd�Zy)rr�rNFc��|j|_|j�%|jj|j�|jr9|jjtjtjd�|jjd|j�|_|jdk(rt|j�|_y|jjd|j�|_y)NT�rbr�wb)rR�
connectionrC�
settimeout�disable_nagle_algorithmr|rA�IPPROTO_TCP�TCP_NODELAY�makefile�rbufsize�rfile�wbufsize�
_SocketWriter�wfiler*s r$r�zStreamRequestHandler.setup$s����,�,����<�<�#��O�O�&�&�t�|�|�4��'�'��O�O�&�&�v�'9�'9�'-�'9�'9�4�
A��_�_�-�-�d�D�M�M�B��
��=�=�A��&�t���7�D�J����1�1�$��
�
�F�D�Jr&c��|jjs	|jj�|jj�|jj�y#tj$rY�JwxYwr()r�closed�flushrA�errorr�rr*s r$r�zStreamRequestHandler.finish1s`���z�z� � �
��
�
� � �"�
	
�
�
�����
�
������<�<�
��
�s�A'�'A=�<A=)	rlrmrnrrrCr�r�r�r)r&r$rrs+��>��H��H��G�$��G�	r&rc�&�eZdZ	d�Zd�Zd�Zd�Zy)rc��||_yr()�_sock)r#�socks  r$r%z_SocketWriter.__init__As	����
r&c��yr<r)r*s r$�writablez_SocketWriter.writableDs��r&c��|jj|�t|�5}|jcddd�S#1swYyxYwr()r
�sendall�
memoryview�nbytes)r#�b�views   r$�writez_SocketWriter.writeGs3���
�
���1��
��]�d��;�;�	�	�]�]�s	�=�Ac�6�|jj�Sr()r
r�r*s r$r�z_SocketWriter.filenoLs���z�z� � �"�"r&N)rlrmrnr%rrr�r)r&r$rr<s��J����
#r&rc��eZdZ	d�Zd�Zy)rc��ddlm}|j\|_|_||j�|_|�|_y)Nr)�BytesIO)�iorrR�packetrArr)r#rs  r$r�zDatagramRequestHandler.setupSs0���#'�<�<� ���T�[��T�[�[�)��
��Y��
r&c��|jj|jj�|j�yr()rA�sendtor�getvaluerSr*s r$r�zDatagramRequestHandler.finishYs)�������4�:�:�.�.�0�$�2E�2E�Fr&N)rlrmrnr�r�r)r&r$rrOs��@��Gr&r)&�__version__rAr1r�rcrrrrEr�__all__r{�extendrr/�SelectSelectorrrrr�listr�r�r
rrrr	rrrrrrr
rrrr)r&r$�<module>r&s���v�t����	�
���"�7���2�v���N�N�J�K�
�6�9���N�N�3�4��r�6�����1�3N�O�P��9�n�%��,�,�O��.�.�O�j�j�Z@�
�@�F
�	�
�8�2�v��U@�U@�pC�t�C�,
�
�%�%�P�2�v��9�<��9�9�<��9�9���9�9���9�
�6�9��(�9�(�(�Y�(�L�N�4D�K�O�n�6H�O��r�6��K�l�4D�K�O��6H�O�#
�#
�\+�-�+�Z#�N�#�&G�/�Gr&

?>