ok

Mini Shell

Direktori : /opt/imunify360/venv/lib64/python3.11/site-packages/aiohttp/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/aiohttp/__pycache__/worker.cpython-311.pyc

�

m��f;"��<�dZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZmZm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZddlmZ	ddlZejZn#e$rdZeZYnwxYwdZGd
�dej ��Z!Gd�de!��Z"Gd�de!��Z#dS)z%Async gunicorn worker for aiohttp.web�N)�	FrameType)�Any�	Awaitable�Callable�Optional�Union)�AccessLogFormat)�base)�web�)�
set_result)�Application)�AccessLogger)�GunicornWebWorker�GunicornUVLoopWebWorker�GunicornTokioWebWorkerc����eZdZejZejZde	de	ddf�fd�Z
d�fd�Zdd�Zdd�Z
dd
�Z	dded	ddfd�Zdd
�Zdededdfd�Zdededdfd�Zede	ddfd���Zdedefd�Z�xZS)r�args�kw�returnNc�d��t��j|i|��d|_d|_d|_dS�Nr)�super�__init__�_task�	exit_code�_notify_waiter)�selfrr�	__class__s   ��E/opt/imunify360/venv/lib64/python3.11/site-packages/aiohttp/worker.pyrzGunicornWebWorker.__init__%s;��������$�%�"�%�%�%�37��
����>B�����c����tj�����tj��|_tj|j��t
�����dS�N)�asyncio�get_event_loop�close�new_event_loop�loop�set_event_loopr�init_process)rrs �r r*zGunicornWebWorker.init_process,s]����� � �&�&�(�(�(��*�,�,��	���t�y�)�)�)�
���������r!c���|j�|�����|_	|j�|j��n*#t
$r|j�d��YnwxYw|j�|j�����|j�	��tj|j��dS)NzException in gunicorn worker)
r(�create_task�_runr�run_until_complete�	Exception�log�	exception�shutdown_asyncgensr&�sys�exitr�rs r �runzGunicornWebWorker.run5s����Y�*�*�4�9�9�;�;�7�7��
�	?��I�(�(���4�4�4�4���	?�	?�	?��H���=�>�>�>�>�>�	?�����	�$�$�T�Y�%A�%A�%C�%C�D�D�D��	���������� � � � � s�A�$A:�9A:c	��K�d}t|jt��r|j}n�tj|j��rA|����d{V��}t|t
j��r
|}|j}n*|}n'td�	|j�����|�_|j
jr|jj
nd}tj||j|j
j||�|j
j�����}|����d{V��|j
jr|�|j
��nd}|}|�J�|j}|�J�|jD]D}tj||||j
jdzdz���}|����d{V���Et3j��}		|jr�|���|j}
|j
jr3|
|j
jkr#d|_|j�d|��np|	t3j��kr?|j t3j!��kr#d|_|j�d|��n|�"���d{V��|j��n#tF$rYnwxYw|�$���d{V��dS)	NzUwsgi app should be either Application or async function returning Application, got {})�logger�keepalive_timeout�
access_log�access_log_format�d�_)�ssl_context�shutdown_timeoutFzMax requests, shutting down: %sz!Parent changed, shutting down: %s)%�
isinstance�wsgirr$�iscoroutinefunctionr�	AppRunner�app�RuntimeError�format�cfg�	accesslogr0r:�	keepalive�_get_valid_log_formatr;�setup�is_ssl�_create_ssl_context�server�sockets�SockSite�graceful_timeout�start�os�getpid�alive�notify�requests_count�max_requests�info�ppid�getppid�_wait_next_notify�
BaseException�cleanup)r�runnerrDrAr:�ctxrN�sock�site�pid�cnts           r r-zGunicornWebWorker._runAs�������d�i��-�-�
	��)�C�C�
�
(���
3�
3�	������$�$�$�$�$�$�D��$��
�.�.�
����j�������?�?E�v�d�i�?P�?P���
�
�>�04��0B�L���,�,��J��]���x�"&�(�"4�%�"&�"<�"<��H�.�#�#����F��l�l�n�n��������48�H�O�M�d�&�&�t�x�0�0�0������!�!�!�����!�!�!��L�	�	�D��<����!%��!:�S�!@�2�!E�	���D��*�*�,�,����������i�k�k��	��*�
3����
�
�
��+���8�(�3�S�4�8�3H�-H�-H�!&�D�J��H�M�M�"C�T�J�J�J�J��B�I�K�K�'�'�D�I�����,E�,E�!&�D�J��H�M�M�"E�t�L�L�L�L��0�0�2�2�2�2�2�2�2�2�2��*�
3����	�	�	��D�	�����n�n�����������s�<CJ�
J"�!J"�asyncio.Future[bool]c��|���|j}|�J�|���x|_}|j�d|j|��|S)Ng�?)�_notify_waiter_doner(�
create_futurer�
call_later)rr(�waiters   r r\z#GunicornWebWorker._wait_next_notify�sb��� � �"�"�"��y������'+�'9�'9�';�';�;���f��	���S�$�":�F�C�C�C��
r!rjc�`�|�|j}|�t|d��||jur	d|_dSdS)NT)rr
)rrjs  r rgz%GunicornWebWorker._notify_waiter_done�sK���>��(�F����v�t�$�$�$��T�(�(�(�"&�D����)�(r!c��|j�tj|jtjd��|j�tj|jtjd��|j�tj|jtjd��|j�tj|j	tjd��|j�tj
|jtj
d��|j�tj|j
tjd��tjtjd��tjtj
d��tjdkr+tjtjtj��dSdS)NF)��)r(�add_signal_handler�signal�SIGQUIT�handle_quit�SIGTERM�handle_exit�SIGINT�SIGWINCH�handle_winch�SIGUSR1�handle_usr1�SIGABRT�handle_abort�siginterruptr3�version_info�SIGCHLD�SIG_DFLr5s r �init_signalszGunicornWebWorker.init_signals�sl��	
�	�$�$��N�D�,�f�n�d�	
�	
�	
�	
�	�$�$��N�D�,�f�n�d�	
�	
�	
�	
�	�$�$��M�4�+�V�]�D�	
�	
�	
�	
�	�$�$��O�T�.����	
�	
�	
�	
�	�$�$��N�D�,�f�n�d�	
�	
�	
�	
�	�$�$��N�D�-�v�~�t�	
�	
�	
�	��F�N�E�2�2�2���F�N�E�2�2�2���f�$�$�

�M�&�.�&�.�9�9�9�9�9�%�$r!�sig�framec�p�d|_|j�|��|���dS)NF)rUrG�
worker_intrg�rr�r�s   r rrzGunicornWebWorker.handle_quit�s;����
�	
����D�!�!�!�	
� � �"�"�"�"�"r!c�~�d|_d|_|j�|��t	jd��dS)NFr)rUrrG�worker_abortr3r4r�s   r r{zGunicornWebWorker.handle_abort�s7����
��������d�#�#�#��������r!rG�
SSLContextc�@�t�td���tj|j��}|�|j|j��|j|_|j	r|�
|j	��|jr|�|j��|S)z~Creates SSLContext instance for usage in asyncio.create_server.

        See ssl.SSLSocket.__init__ for more details.
        NzSSL is not supported.)
�sslrEr��ssl_version�load_cert_chain�certfile�keyfile�	cert_reqs�verify_mode�ca_certs�load_verify_locations�ciphers�set_ciphers)rGr`s  r rMz%GunicornWebWorker._create_ssl_context�s����;��6�7�7�7��n�S�_�-�-�����C�L�#�+�6�6�6��-����<�	4��%�%�c�l�3�3�3��;�	)��O�O�C�K�(�(�(��
r!�
source_formatc�r�||jkr|jStjd|��rt	d���|S)Nz%\([^\)]+\)z�Gunicorn's style options in form of `%(name)s` are not supported for the log formatting. Please use aiohttp's format specification to configure access log formatting: http://docs.aiohttp.org/en/stable/logging.html#format-specification)�DEFAULT_GUNICORN_LOG_FORMAT�DEFAULT_AIOHTTP_LOG_FORMAT�re�search�
ValueError)rr�s  r rJz'GunicornWebWorker._get_valid_log_format�sL���D�<�<�<��2�2�
�Y�~�}�
5�
5�		!��(���
�!� r!�rN)rrer#)�__name__�
__module__�__qualname__r�
LOG_FORMATr��GunicornAccessLogFormat�defaultr�rrr*r6r-r\rrgr��intrrrr{�staticmethodrM�strrJ�
__classcell__�rs@r rr s��������!-�!8��"9�"A��C�c�C��C��C�C�C�C�C�C�������
!�
!�
!�
!�@�@�@�@�D����:>�	'�	'��5�6�	'�	
�	'�	'�	'�	'�&:�&:�&:�&:�P#�s�#�9�#��#�#�#�#����I��$��������������\��"!�3�!�3�!�!�!�!�!�!�!�!r!rc� ��eZdZd�fd�Z�xZS)rrNc����ddl}tj�����tj|�����t
�����dSr)�uvloopr$r%r&�set_event_loop_policy�EventLoopPolicyrr*)rr�rs  �r r*z$GunicornUVLoopWebWorker.init_process�sd����
�
�
�	�� � �&�&�(�(�(�
	�%�f�&<�&<�&>�&>�?�?�?�
���������r!r��r�r�r�r*r�r�s@r rr��=����������������r!rc� ��eZdZd�fd�Z�xZS)rrNc����ddl}tj�����tj|�����t
�����dSr)�tokior$r%r&r�r�rr*)rr�rs  �r r*z#GunicornTokioWebWorker.init_processsd�������	�� � �&�&�(�(�(�
	�%�e�&;�&;�&=�&=�>�>�>�
���������r!r�r�r�s@r rrr�r!r)$�__doc__r$rSr�rpr3�typesr�typingrrrrr�gunicorn.configr	r��gunicorn.workersr
�aiohttpr�helpersr
�web_appr�web_logrr�r��ImportError�object�__all__�Workerrrr�r!r �<module>r�s���+�+�����	�	�	�	�	�	�	�	�
�
�
�
�
�
�
�
�������<�<�<�<�<�<�<�<�<�<�<�<�<�<�F�F�F�F�F�F�!�!�!�!�!�!������������� � � � � � �!�!�!�!�!�!���J�J�J���J�J������
�C��J�J�J�����
U��M!�M!�M!�M!�M!���M!�M!�M!�`
�
�
�
�
�/�
�
�
� 
�
�
�
�
�.�
�
�
�
�
s�A�	A(�'A(

Zerion Mini Shell 1.0