
    Vh                        d Z ddlZddlmZ ddlmZmZ ddlmZ ddl	m
Z
mZ  ee       G d dej                               Zed	k(  r ej                  ej                   d
         j#                           e
j$                   eej                   d   d             ddlmZ  e       Z ej,                  e        ej.                           ej0                  ej2                         yy)z
Main program for the child process run by
L{twisted.test.test_stdio.StandardInputOutputTests.test_readConnectionLost} to
test that IHalfCloseableProtocol.readConnectionLost works for stdio transports.
    N)implementer)protocolstdio)IHalfCloseableProtocol)logreflectc                   ,    e Zd ZdZdZd Zd Zd Zd Zy)HalfCloseProtocolz
    A protocol to hook up to stdio and observe its transport being
    half-closed.  If all goes as expected, C{exitCode} will be set to C{0};
    otherwise it will be set to C{1} to indicate failure.
    Nc                 :    | j                   j                  d       y)z=
        Signal the parent process that we're ready.
           xN)	transportwriteselfs    Q/home/dcms/DCMS/lib/python3.12/site-packages/twisted/test/stdio_test_halfclose.pyconnectionMadez HalfCloseProtocol.connectionMade   s     	T"    c                 :    d| _         t        j                          y)zv
        This is the desired event.  Once it has happened, stop the reactor so
        the process will exit.
        r   N)exitCodereactorstopr   s    r   readConnectionLostz$HalfCloseProtocol.readConnectionLost%   s    
 r   c                 ~    | j                   d| _         t        j                  |d       t        j                          y)z
        This may only be invoked after C{readConnectionLost}.  If it happens
        otherwise, mark it as an error and shut down.
        N   z!Unexpected call to connectionLost)r   r   errr   r   )r   reasons     r   connectionLostz HalfCloseProtocol.connectionLost-   s-    
 == DMGGF?@r   c                      y )N r   s    r   writeConnectionLostz%HalfCloseProtocol.writeConnectionLost7   s    r   )	__name__
__module____qualname____doc__r   r   r   r   r    r   r   r   r
   r
      s"     H#r   r
   __main__r      wb)r   )r$   syszope.interfacer   twisted.internetr   r   twisted.internet.interfacesr   twisted.pythonr   r   Protocolr
   r!   namedAnyargvinstallstartLoggingopenr   halfCloseProtocol
StandardIOrunexitr   r   r   r   <module>r7      s   
  & , > ' #$#)) # %#L zGSXXa[!))+CT#((1+t,-()+E&'GKKMCHH''( r   