AlkantarClanX12

Your IP : 3.142.53.184


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/ssa/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/ssa/__pycache__/agent.cpython-311.pyc

�

9�1g���t�dZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZddlm
Z
Gd	�d
��ZdS)zH
This module contains contains classes implementing SSA Agent behaviour
�N)�Thread�current_thread�)�
agent_sock)�SSAError)�
create_socket)�RequestProcessorc�8�eZdZdZd�Zdd�Zd
d�Zd	d
defd�ZdS)�SimpleAgentz 
    SSA Simple Agent class
    c��tjd��|_t��|_|���dS)N�agent)�logging�	getLogger�loggerr	�request_processor�listen)�selfs �@/opt/cloudlinux/venv/lib64/python3.11/site-packages/ssa/agent.py�__init__zSimpleAgent.__init__s3���'��0�0���!1�!3�!3������
�
�
�
�
��returnNc���tt��}	|���\}}t|j|f���}|���|j�d|j���c)z(
        Start listening socket
        T)�target�argsz[%s] Started)	rr�acceptr�handle�startr�debug�name)r�_socket�
connection�address�ts     rrzSimpleAgent.listensl�� �
�+�+��	6�")�.�.�"2�"2��J���d�k��
�>�>�>�A�
�G�G�I�I�I��K���n�a�f�5�5�5�		6rr!�
socket objectc�^�|�d���}	|�|��}|j�|��nQ#t$rD}|j�dt��jt|����Yd}~nd}~wwxYw|�
��dS)z�
        Handle incoming connection
        :param connection: socket object usable to
        send and receive data on the connection
        �ignore)�errorszHandled exception in [%s]: %sN)�makefile�
read_inputrrrr�errorrr�str�close)rr!�fileobj�
input_data�es     rrzSimpleAgent.handle*s����%�%�X�%�6�6��	�����1�1�J��"�)�)�*�5�5�5�5���	�	�	��K���=�,�.�.�3�S��V�V�
=�
=�
=��D�D�D�D�����	����	�������s�/A�
B�:B�B�fileiozfile objectc��|���}|j�dt��jt|�����|��|r(tj|�	��d���SiS)zy
        Read input data and return decoded json
        :param fileio: a file-like object providing read method
        z[%s] I received %i bytes: %sF)�strict)
�readr�inforr�len�encode�json�loads�strip)rr0�datas   rr)zSimpleAgent.read_input:s{��
�{�{�}�}������7�'�)�)�.��D�K�K�M�M�0B�0B��	�	�	��	��:�d�j�j�l�l�5�9�9�9�9��Ir)rN)r!r$rN)	�__name__�
__module__�__qualname__�__doc__rrr�dictr)�rrrrsw�����������	6�	6�	6�	6����� ���4������rr)r>r7r�	threadingrr�internal.constantsr�internal.exceptionsr�internal.utilsr�modules.processorr	rr@rr�<module>rFs�������������,�,�,�,�,�,�,�,�*�*�*�*�*�*�)�)�)�)�)�)�)�)�)�)�)�)�/�/�/�/�/�/�2�2�2�2�2�2�2�2�2�2r