HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/twisted/protocols/__pycache__/stateful.cpython-312.pyc
�

oj���F�ddlmZddlmZGd�dej�Zy)�)�BytesIO)�protocolc�&�eZdZdZdZd�Zd�Zd�Zy)�StatefulProtocola-A Protocol that stores state for you.

    state is a pair (function, num_bytes). When num_bytes bytes of data arrives
    from the network, function is called. It is expected to return the next
    state or None to keep same state. Initial state is returned by
    getInitialState (override it).
    )NNrc��tjj||�|j�t	�df|_y)Nr)r�Protocol�makeConnection�getInitialStater�
_sful_data)�self�	transports  �</usr/lib/python3/dist-packages/twisted/protocols/stateful.pyr	zStatefulProtocol.makeConnections1�����(�(��y�9��.�.�0�'�)�Q�>���c��t�)N)�NotImplementedError)rs rr
z StatefulProtocol.getInitialStates��!�!rc��|j\}}}|jdd�|j|�|j�}|j|�||z
|dk\rN|j	|d�}||dz
}|d|�}|j
jry|r|}||z
|dk\r�N|dk7rD|j	�}|jd�|j�|j|�d}|||f|_y)Nr��)r�seek�write�tell�readr
�
disconnecting�truncate)	r�data�state�buffer�offset�blen�d�next�bs	         r�dataReceivedzStatefulProtocol.dataReceiveds��� $�����v�v����A�q�����T���{�{�}�����F���V�m�u�Q�x�'����E�!�H�%�A��e�A�h��F��5��8�A�;�D����,�,������V�m�u�Q�x�'��Q�;����
�A��K�K��N��O�O���L�L��O��F����/��rN)�__name__�
__module__�__qualname__�__doc__rr	r
r#�rrrrs����J�?�"�0rrN)�ior�twisted.internetrrrr(rr�<module>r+s���%�(0�x�(�(�(0r