o
    ¯bá  ã                   @   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)ÚfdescÚprocessÚreactor)ÚProtocolÚServerFactory)Úwire)ÚechoÚchargenÚdiscardÚdaytimeÚ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  ¡ }||dœ}| jjr| jj ¡ |d< t |¡ d|v r&t |d ¡ | jj}|j}|j}|t	 
¡ kr8d }|t	 ¡ kr@d }t d |j|jt	jd d |||¡	 t | j ¡ t | j ¡ d S )N)r   é   é   )Ú	transportÚfilenoÚfactoryÚ
stderrFiler   ÚsetBlockingÚserviceÚuserÚgroupÚosÚgetuidÚgetgidr   ÚProcessÚprogramÚprogramArgsÚenvironr   ÚremoveReaderÚremoveWriter)ÚselfÚsockFDÚchildFDsr   ÚuidÚgid© r&   ú6/usr/lib/python3/dist-packages/twisted/runner/inetd.pyÚconnectionMade#   s6   


÷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__O   s   
zInetdFactory.__init__)r)   r*   r+   r   Úprotocolr   r.   r&   r&   r&   r'   r-   K   s    r-   )r,   r   Útwisted.internetr   r   r   Útwisted.internet.protocolr   r   Útwisted.protocolsr   ÚEchoÚChargenÚDiscardÚDaytimeÚTimeÚinternalProtocolsr   r-   r&   r&   r&   r'   Ú<module>   s   	û	+