3
,s²Yª  ã               @   sz   d Z ddlZddlmZmZmZ ddlmZmZ ddl	m
Z
 e
je
je
je
je
jdœZG dd„ deƒZG d	d
„ d
eƒZdS )z‰
Twisted inetd.

Maintainer: Andrew Bennetts

Future Plans: Bugfixes.  Specifically for UDP and Sun-RPC, which don't work
correctly yet.
é    N)ÚprocessÚreactorÚfdesc)ÚProtocolÚServerFactory)Úwire)ZechoZchargenÚdiscardZdaytimeZtimec               @   s   e Zd ZdZdd„ ZdS )ÚInetdProtocolzDForks a child process on connectionMade, passing the socket as fd 0.c          
   C   s¼   | j jƒ }||dœ}| jjr,| jjjƒ |d< tj|ƒ d|krLtj|d ƒ | jj}|j}|j}|t	j
ƒ krpd }|t	jƒ kr€d }tjd |j|jt	jd d |||ƒ	 tj| j ƒ tj| j ƒ d S )N)r   é   é   )Z	transportÚfilenoÚfactoryÚ
stderrFiler   ZsetBlockingÚserviceÚuserÚgroupÚosÚgetuidÚgetgidr   ZProcessZprogramZprogramArgsÚenvironr   ZremoveReaderZremoveWriter)ÚselfZsockFDZchildFDsr   ZuidÚgid© r   ú6/usr/lib/python3/dist-packages/twisted/runner/inetd.pyÚconnectionMade"   s$    


zInetdProtocol.connectionMadeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r	       s   r	   c               @   s   e Zd ZeZdZdd„ ZdS )ÚInetdFactoryNc             C   s
   || _ d S )N)r   )r   r   r   r   r   Ú__init__E   s    zInetdFactory.__init__)r   r   r   r	   Zprotocolr   r    r   r   r   r   r   A   s   r   )r   r   Ztwisted.internetr   r   r   Ztwisted.internet.protocolr   r   Ztwisted.protocolsr   ZEchoZChargenZDiscardZDaytimeZTimeZinternalProtocolsr	   r   r   r   r   r   Ú<module>   s   
!