ok
Direktori : /opt/cloudlinux/venv/lib64/python3.11/site-packages/ssa/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/ssa/__pycache__/agent.cpython-311.pyc |
� ��f� � �t � d Z ddlZddlZddlmZmZ ddlmZ ddlm Z ddl mZ ddlm Z G d � d � � ZdS )zH This module contains contains classes implementing SSA Agent behaviour � N)�Thread�current_thread� )� agent_sock)�SSAError)� create_socket)�RequestProcessorc �8 � e Zd ZdZd� Zdd�Zd d�Zd d defd�ZdS )�SimpleAgentz SSA Simple Agent class c � � t j d� � | _ t � � | _ | � � � d S )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 �� � t t � � } |� � � \ }}t | j |f�� � }|� � � | j � d|j � � �c)z( Start listening socket T)�target�argsz[%s] Started) r r �acceptr �handle�startr �debug�name)r �_socket� connection�address�ts r r zSimpleAgent.listen sl � � � �+�+�� 6�")�.�.�"2�"2��J���d�k�� �>�>�>�A� �G�G�I�I�I��K���n�a�f�5�5�5� 6r r! � socket objectc �^ � |� d�� � } | � |� � }| j � |� � nQ# t $ rD}| j � dt � � j t |� � � � Y d}~nd}~ww xY w|� � � 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_inputr r r r �errorr r �str�close)r r! �fileobj� input_data�es r r zSimpleAgent.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 � � j t |� � � � � |� � |r(t j |� � � d�� � S i S )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 �infor r �len�encode�json�loads�strip)r r0 �datas r r) zSimpleAgent.read_input: s{ � � �{�{�}�}������7�'�)�)�.��D�K�K�M�M�0B�0B�� � � � � ��:�d�j�j�l�l�5�9�9�9�9��Ir )r N)r! r$ r N) �__name__� __module__�__qualname__�__doc__r r r �dictr) � r r r r sw � � � � � �� �� � � 6� 6� 6� 6�� � � � �� �4� � � � � � r r )r>