%PDF- %PDF-
Direktori : /lib/python3/dist-packages/twisted/protocols/__pycache__/ |
Current File : //lib/python3/dist-packages/twisted/protocols/__pycache__/pcp.cpython-312.pyc |
� Ϫ�f � � � d Z ddlmZ ddlmZ eej ej � G d� d� � Z G d� de� Zy) z Producer-Consumer Proxy. � )�implementer)� interfacesc �h � e Zd ZdZdZdZdZdZdZdZ dZ d� Zd� Zd� Z d� Zd � Zd � Zd� Zd� Zd efd�Zy)�BasicProducerConsumerProxyaa I can act as a man in the middle between any Producer and Consumer. @ivar producer: the Producer I subscribe to. @type producer: L{IProducer<interfaces.IProducer>} @ivar consumer: the Consumer I publish to. @type consumer: L{IConsumer<interfaces.IConsumer>} @ivar paused: As a Producer, am I paused? @type paused: bool NTFc �^ � g | _ |�$|| _ |j | | j � y y �N)�_buffer�consumer�registerProducer�iAmStreaming)�selfr s �7/usr/lib/python3/dist-packages/twisted/protocols/pcp.py�__init__z#BasicProducerConsumerProxy.__init__# s1 � ������$�D�M��%�%�d�D�,=�,=�>� � c �` � d| _ | j r| j j � y y �NT)�paused�producer�pauseProducing�r s r r z)BasicProducerConsumerProxy.pauseProducing+ s% � �����=�=��M�M�(�(�*� r c �& � d| _ | j rD| j j dj | j � � g | j d d n| j sd| _ | j �| j j � y y )NF� T) r r r �write�joinr �outstandingPullr �resumeProducingr s r r z*BasicProducerConsumerProxy.resumeProducing0 sl � �����<�<��M�M��������� 5�6� �D�L�L��O��$�$�'+��$��=�=�$��M�M�)�)�+� %r c �n � | j �| j j � | j �| `y y r )r � stopProducingr r s r r z(BasicProducerConsumerProxy.stopProducing= s0 � ��=�=�$��M�M�'�'�)��=�=�$�� � %r c �� � | j s| j s(| j s| j j |� y | j �#| j j |� d| _ y y �NF)r r r r �appendr r �r �datas r r z BasicProducerConsumerProxy.writeE sT � ��;�;�t�0�0��9M�9M��L�L����%� �]�]� &��M�M����%�#(�D� � 'r c �p � | j �| j j � | j � y r )r �finish�unregisterProducerr s r r% z!BasicProducerConsumerProxy.finishN s( � ��=�=�$��M�M� � �"����!r c � � || _ || _ y r )r �producerIsStreaming�r r � streamings r r z+BasicProducerConsumerProxy.registerProducerS s � � �� �#,�� r c �r � | j �| ` | `| j r| j j � y y r )r r( r r&