o
    ¯bÌ  ã                   @   s‚   d Z ddlZddlmZmZ ddlmZmZ G dd„ dejƒZ	e
dkr?e ejd ¡ ¡  dd	lmZ e e	ƒ ¡ e ¡  dS dS )
z«
Main program for the child process run by
L{twisted.test.test_stdio.StandardInputOutputTests.test_producer} to test
that process transports implement IProducer properly.
é    N)ÚprotocolÚstdio)ÚlogÚreflectc                   @   s4   e Zd ZdZdZdd„ Zdd„ Zdd„ Zd	d
„ ZdS )ÚProducerChildFó    c                 C   s   t  d¡ t dtj¡ d S )Nz*****OVER*****é   )r   ÚmsgÚreactorÚ	callLaterÚstop)ÚselfÚreason© r   úB/usr/lib/python3/dist-packages/twisted/test/stdio_test_producer.pyÚconnectionLost   s   
zProducerChild.connectionLostc                 C   sj   |  j |7  _ | jrt tj¡ t d¡ | j ¡  d S | j 	|¡ | j  
d¡r/| j ¡  d S |  ¡  d S )Nz$dataReceived while transport paused!s   
0
)ÚbufÚ_pausedr   ÚstartLoggingÚsysÚstderrr	   Ú	transportÚloseConnectionÚwriteÚendswithÚpause)r   Údatar   r   r   ÚdataReceived   s   
zProducerChild.dataReceivedc                 C   s"   d| _ | j ¡  t d| j¡ d S )NTg{®Gáz„?)r   r   ÚpauseProducingr
   r   Úunpause©r   r   r   r   r   '   s   
zProducerChild.pausec                 C   s   d| _ | j ¡  d S )NF)r   r   ÚresumeProducingr    r   r   r   r   ,   s   zProducerChild.unpauseN)	Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r   r   r      s    r   Ú__main__r   )r
   )Ú__doc__r   Útwisted.internetr   r   Útwisted.pythonr   r   ÚProtocolr   r"   ÚnamedAnyÚargvÚinstallr
   Ú
StandardIOÚrunr   r   r   r   Ú<module>   s   û