U
    ¹êW[õf  ã                   @   s¾  d Z ddlmZmZ ddlZddlZddlZddlZddlm	Z	m
Z
 ddlmZmZmZ ddlmZmZ ddlmZmZ ddlmZmZmZmZmZmZmZmZmZmZ dd	l m!Z!m"Z"m#Z# dd
l$m%Z%m&Z& e 'd¡Z(e 'd¡Z)zddl*m+Z+ W nF e,k
r6   dZ+zddlm-Z- W n e,k
r0   dZ-Y nX Y nX e%dkZ.dZ/e.rnddlm0Z0m1Z1 ddlm2Z2m3Z3 dZ/e& 4¡ r¤zddl5Z5dZ/W n e,k
r¢   dZ5Y nX G dd„ de!j6ƒZ7G dd„ de!j6e8ƒZ9G dd„ de9ƒZ:e%dkrêe:Z;ne7Z;G dd„ de9ƒZ<G dd„ de8ƒZ=e	eeeƒG dd„ dee=eƒƒZ>G d d!„ d!e8ƒZ?e	eƒG d"d#„ d#e?e=ƒƒZ@e+dk	sle-dk	rve
e>eƒ e.rˆe
e>eeƒ e/r˜e
e>eƒ eAed$dƒdk	r´e
e>eƒ dgZBdS )%z
Posix reactor base class
é    )ÚdivisionÚabsolute_importN)ÚimplementerÚclassImplements)ÚerrorÚudpÚtcp)ÚReactorBaseÚ_SignalReactorMixin)ÚCONNECTION_DONEÚCONNECTION_LOST)
ÚIReactorUNIXÚIReactorUNIXDatagramÚIReactorTCPÚIReactorUDPÚIReactorSSLÚIReactorSocketÚIHalfCloseableDescriptorÚIReactorProcessÚIReactorMulticastÚIReactorFDSet)ÚlogÚfailureÚutil)ÚplatformTypeÚplatformzHandler has no fileno methodzFile descriptor lost)Útls)ÚsslÚposixF)ÚfdescÚunix)ÚprocessÚ_signalsTc                   @   s4   e Zd ZdZdZdd„ Zdd„ Zdd„ Zd	d
„ ZdS )Ú_SocketWakerzù
    The I{self-pipe trick<http://cr.yp.to/docs/selfpipe.html>}, implemented
    using a pair of sockets rather than pipes (due to the lack of support in
    select() on Windows for pipes), used to wake up the main loop from
    another thread.
    r   c                 C   s”   || _ t tjtj¡}t tjtj¡}| tjtjd¡ | d¡ | d¡ | 	| 
¡ ¡ | ¡ \}}| d¡ | d¡ || _|| _| jj| _dS )úInitialize.
        é   )z	127.0.0.1r   r   N)ÚreactorÚsocketÚAF_INETZSOCK_STREAMZ
setsockoptZIPPROTO_TCPZTCP_NODELAYZbindZlistenÚconnectZgetsocknameZacceptZsetblockingÚrÚwÚfileno)Úselfr&   ZserverZclientÚreaderZ
clientaddr© r/   ú</usr/lib/python3/dist-packages/twisted/internet/posixbase.pyÚ__init__E   s    



z_SocketWaker.__init__c              
   C   sP   zt  | jjd¡ W n6 tjk
rJ } z|jd tjkr:‚ W 5 d}~X Y nX dS )z&Send a byte to my connection.
        ó   xr   N)	r   ÚuntilConcludesr+   Úsendr'   r   ÚargsÚerrnoZWSAEWOULDBLOCK©r-   Úer/   r/   r0   ÚwakeUpW   s
    z_SocketWaker.wakeUpc                 C   s,   z| j  d¡ W n tjk
r&   Y nX dS )z+Read some data from my connection.
        é    N)r*   Zrecvr'   r   ©r-   r/   r/   r0   ÚdoRead`   s    z_SocketWaker.doReadc                 C   s   | j  ¡  | j ¡  d S ©N)r*   Úcloser+   )r-   Úreasonr/   r/   r0   ÚconnectionLosth   s    
z_SocketWaker.connectionLostN)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__Údisconnectedr1   r9   r<   r@   r/   r/   r/   r0   r#   <   s   	r#   c                   @   s4   e Zd ZdZdZdZdZdd„ Zdd„ Zdd	„ Z	dS )
Ú_FDWakeraö  
    The I{self-pipe trick<http://cr.yp.to/docs/selfpipe.html>}, used to wake
    up the main loop from another thread or a signal handler.

    L{_FDWaker} is a base class for waker implementations based on
    writing to a pipe being monitored by the reactor.

    @ivar o: The file descriptor for the end of the pipe which can be
        written to wake up a reactor monitoring this waker.

    @ivar i: The file descriptor which should be monitored in order to
        be awoken by this waker.
    r   Nc                    sX   |ˆ _ t ¡ \ˆ _ˆ _t ˆ j¡ t ˆ j¡ t ˆ j¡ t ˆ j¡ ‡ fdd„ˆ _dS )r$   c                      s   ˆ j S r=   )Úir/   r;   r/   r0   Ú<lambda>Š   ó    z#_FDWaker.__init__.<locals>.<lambda>N)	r&   ÚosÚpiperG   Úor   ZsetNonBlockingZ_setCloseOnExecr,   ©r-   r&   r/   r;   r0   r1      s    z_FDWaker.__init__c                 C   s   t  |  ¡ dd„ ¡ dS )zA
        Read some bytes from the pipe and discard them.
        c                 S   s   d S r=   r/   )Údatar/   r/   r0   rH   ‘   rI   z!_FDWaker.doRead.<locals>.<lambda>N)r   Z
readFromFDr,   r;   r/   r/   r0   r<      s    z_FDWaker.doReadc              	   C   sP   t | dƒsdS | j| jfD ](}zt |¡ W q tk
r@   Y qX q| `| `dS )z$Close both ends of my pipe.
        rL   N)ÚhasattrrG   rL   rJ   r>   ÚIOError)r-   r?   Úfdr/   r/   r0   r@   ”   s    
z_FDWaker.connectionLost)
rA   rB   rC   rD   rE   rG   rL   r1   r<   r@   r/   r/   r/   r0   rF   n   s   rF   c                   @   s   e Zd ZdZdd„ ZdS )Ú
_UnixWakerzŽ
    This class provides a simple interface to wake up the event loop.

    This is used by threads or signals to wake up the event loop.
    c              
   C   sV   | j dk	rRzt tj| j d¡ W n0 tk
rP } z|jtjkr@‚ W 5 d}~X Y nX dS )z2Write one byte to the pipe, and flush it.
        Nr2   )rL   r   r3   rJ   ÚwriteÚOSErrorr6   ZEAGAINr7   r/   r/   r0   r9   ©   s    
z_UnixWaker.wakeUpN)rA   rB   rC   rD   r9   r/   r/   r/   r0   rR   ¢   s   rR   c                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )Ú_SIGCHLDWakerz}
    L{_SIGCHLDWaker} can wake up a reactor whenever C{SIGCHLD} is
    received.

    @see: L{twisted.internet._signals}
    c                 C   s   t  | |¡ d S r=   )rF   r1   rM   r/   r/   r0   r1   Ç   s    z_SIGCHLDWaker.__init__c                 C   s   t  | j¡ dS )zJ
        Install the handler necessary to make this waker active.
        N)r"   ÚinstallHandlerrL   r;   r/   r/   r0   ÚinstallË   s    z_SIGCHLDWaker.installc                 C   s   t  d¡ dS )zC
        Remove the handler which makes this waker active.
        éÿÿÿÿN)r"   rV   r;   r/   r/   r0   Ú	uninstallÒ   s    z_SIGCHLDWaker.uninstallc                 C   s   t  | ¡ t ¡  dS )a  
        Having woken up the reactor in response to receipt of
        C{SIGCHLD}, reap the process which exited.

        This is called whenever the reactor notices the waker pipe is
        writeable, which happens soon after any call to the C{wakeUp}
        method.
        N)rF   r<   r!   ÚreapAllProcessesr;   r/   r/   r0   r<   Ù   s    	
z_SIGCHLDWaker.doReadN)rA   rB   rC   rD   r1   rW   rY   r<   r/   r/   r/   r0   rU   À   s
   rU   c                   @   s<   e Zd ZdZeje e ¡ ¡eje e ¡ ¡ifdd„Z	dS )Ú_DisconnectSelectableMixinz>
    Mixin providing the C{_disconnectSelectable} method.
    c                 C   st   |   |¡ | |j¡}|rV|r@|jtjkr@t |¡r@| |¡ qp|  |¡ | 	|¡ n|  |¡ | 	t
 |¡¡ dS )z¿
        Utility function for disconnecting a selectable.

        Supports half-close notification, isRead should be boolean indicating
        whether error resulted from doRead().
        N)ÚremoveReaderÚgetÚ	__class__r   ÚConnectionDoner   Z
providedByZreadConnectionLostÚremoveWriterr@   r   ÚFailure)r-   Ú
selectableÚwhyZisReadZfaildictÚfr/   r/   r0   Ú_disconnectSelectableí   s    

ÿ

z0_DisconnectSelectableMixin._disconnectSelectableN)
rA   rB   rC   rD   r   r_   r   ra   ZConnectionLostre   r/   r/   r/   r0   r[   è   s     þr[   c                   @   sð   e Zd ZdZeZdd„ ZdZdd„ Zdd„ Z	d	i dddd
dfdd„Z
d/dd„Zd0dd„Zd1dd„Zd2dd„Zd3dd„Zd4dd„Zer–ejejejfZnejejfZdd „ Zd!d"„ Zd5d#d$„Zd6d%d&„Zd7d'd(„Zd8d)d*„Zd9d+d,„Zd-d.„ ZdS ):ÚPosixReactorBasezÄ
    A basis for reactors that use file descriptors.

    @ivar _childWaker: L{None} or a reference to the L{_SIGCHLDWaker}
        which is used to properly notice child process termination.
    c                 C   s0   | j s,|  | ¡| _ | j | j ¡ |  | j ¡ dS )zå
        Install a `waker' to allow threads and signals to wake up the IO thread.

        We use the self-pipe trick (http://cr.yp.to/docs/selfpipe.html) to wake
        the reactor. On Windows we use a pair of sockets.
        N)ZwakerÚ_wakerFactoryÚ_internalReadersÚaddÚ	addReaderr;   r/   r/   r0   ÚinstallWaker  s    zPosixReactorBase.installWakerNc                 C   sV   t  | ¡ tdkrRtrR| js@t| ƒ| _| j | j¡ |  | j¡ | j 	¡  t
 ¡  dS )zŽ
        Extend the basic signal handling logic to also support
        handling SIGCHLD to know when to try to reap child processes.
        r   N)r
   Ú_handleSignalsr   ÚprocessEnabledÚ_childWakerrU   rh   ri   rj   rW   r!   rZ   r;   r/   r/   r0   rl   "  s    


zPosixReactorBase._handleSignalsc                 C   s   | j r| j  ¡  dS )aª  
        If a child waker was created and installed, uninstall it now.

        Since this disables reactor functionality and is only called
        when the reactor is stopping, it doesn't provide any directly
        useful functionality, but the cleanup of reactor-related
        process-global state that it does helps in unit tests
        involving multiple reactors and is generally just a nice
        thing.
        N)rn   rY   r;   r/   r/   r0   Ú_uninstallHandler5  s    z"PosixReactorBase._uninstallHandlerr/   r   c
                 C   sÚ   |   ||¡\}}tdkrb|rF|	d k	r,tdƒ‚t | ||||||||¡	S t | ||||||||	¡	S nttdkrÎ|d k	rztdƒ‚|d k	rŠtdƒ‚|r–tdƒ‚|	r¢tdƒ‚trÄdd	lm}
 |
| |||||ƒS td
ƒ‚ntdƒ‚d S )Nr   z1Using childFDs is not supported with usePTY=True.Zwin32z,Setting UID is unsupported on this platform.z,Setting GID is unsupported on this platform.z1The usePTY parameter is not supported on Windows.z1Customizing childFDs is not supported on Windows.r   )ÚProcessz:spawnProcess not available since pywin32 is not installed.z0spawnProcess only available on Windows or POSIX.)	Z_checkProcessArgsr   Ú
ValueErrorr!   Z
PTYProcessrp   Úwin32processZtwisted.internet._dumbwin32procÚNotImplementedError)r-   ZprocessProtocolÚ
executabler5   ÚenvÚpathZuidÚgidZusePTYZchildFDsrp   r/   r/   r0   ÚspawnProcessH  sF       ÿ   ÿÿÿzPosixReactorBase.spawnProcessÚ r:   c                 C   s   t  ||||| ¡}| ¡  |S )z‡Connects a given L{DatagramProtocol} to the given numeric UDP port.

        @returns: object conforming to L{IListeningPort}.
        )r   ÚPortÚstartListening)r-   ÚportÚprotocolÚ	interfaceÚmaxPacketSizeÚpr/   r/   r0   Ú	listenUDPk  s    zPosixReactorBase.listenUDPFc                 C   s    t  ||||| |¡}| ¡  |S )z˜Connects a given DatagramProtocol to the given numeric UDP port.

        EXPERIMENTAL.

        @returns: object conforming to IListeningPort.
        )r   ZMulticastPortr{   )r-   r|   r}   r~   r   ZlistenMultipler€   r/   r/   r0   ÚlistenMulticastv  s    z PosixReactorBase.listenMulticasté   c                 C   s*   t stdƒ‚t |||| |¡}| ¡  |S ©NúUNIX support is not present)ÚunixEnabledÚAssertionErrorr    Ú	Connectorr)   )r-   ÚaddressÚfactoryÚtimeoutZcheckPIDÚcr/   r/   r0   ÚconnectUNIX„  s    zPosixReactorBase.connectUNIXé2   é¶  c                 C   s,   t stdƒ‚t ||||| |¡}| ¡  |S r„   )r†   r‡   r    rz   r{   )r-   r‰   rŠ   ÚbacklogÚmodeZwantPIDr€   r/   r/   r0   Ú
listenUNIXŠ  s    zPosixReactorBase.listenUNIXc                 C   s*   t stdƒ‚t ||||| ¡}| ¡  |S )z›
        Connects a given L{DatagramProtocol} to the given path.

        EXPERIMENTAL.

        @returns: object conforming to L{IListeningPort}.
        r…   )r†   r‡   r    ZDatagramPortr{   )r-   r‰   r}   r   r‘   r€   r/   r/   r0   ÚlistenUNIXDatagram“  s    	z#PosixReactorBase.listenUNIXDatagramc                 C   s,   t stdƒ‚t |||||| ¡}| ¡  |S )zd
        Connects a L{ConnectedDatagramProtocol} instance to a path.

        EXPERIMENTAL.
        r…   )r†   r‡   r    ZConnectedDatagramPortr{   )r-   r‰   r}   r   r‘   ÚbindAddressr€   r/   r/   r0   ÚconnectUNIXDatagram¡  s    z$PosixReactorBase.connectUNIXDatagramc                 C   sR   || j krt |¡‚tr4|tjkr4tj | ||¡}nt	j | |||¡}| 
¡  |S )a0  
        Create a new L{IListeningPort} from an already-initialized socket.

        This just dispatches to a suitable port implementation (eg from
        L{IReactorTCP}, etc) based on the specified C{addressFamily}.

        @see: L{twisted.internet.interfaces.IReactorSocket.adoptStreamPort}
        )Ú_supportedAddressFamiliesr   ÚUnsupportedAddressFamilyr†   r'   ÚAF_UNIXr    rz   Ú_fromListeningDescriptorr   r{   )r-   ÚfileDescriptorÚaddressFamilyrŠ   r€   r/   r/   r0   ÚadoptStreamPort¹  s     	

  ÿ   ÿz PosixReactorBase.adoptStreamPortc                 C   sH   || j krt |¡‚tr2|tjkr2tj ||| ¡S t	j |||| ¡S dS )zg
        @see:
            L{twisted.internet.interfaces.IReactorSocket.adoptStreamConnection}
        N)
r–   r   r—   r†   r'   r˜   r    ZServerZ_fromConnectedSocketr   )r-   rš   r›   rŠ   r/   r/   r0   ÚadoptStreamConnectionÎ  s    

  ÿ   ÿz&PosixReactorBase.adoptStreamConnectionc                 C   s<   |t jt jfkrt |¡‚tjj| ||||d}| ¡  |S )N)r   )	r'   r(   ÚAF_INET6r   r—   r   rz   r™   r{   )r-   rš   r›   r}   r   r€   r/   r/   r0   ÚadoptDatagramPortÞ  s    
   þz"PosixReactorBase.adoptDatagramPortc                 C   s   t  ||||| ¡}| ¡  |S r=   )r   rz   r{   )r-   r|   rŠ   r   r~   r€   r/   r/   r0   Ú	listenTCPí  s    zPosixReactorBase.listenTCPc                 C   s    t  |||||| ¡}| ¡  |S r=   )r   rˆ   r)   )r-   Úhostr|   rŠ   r‹   r”   rŒ   r/   r/   r0   Ú
connectTCPò  s    zPosixReactorBase.connectTCPc           	   	   C   sb   t d k	r(t  |d|¡}|  |||||¡S td k	rRt ||||||| ¡}| ¡  |S ds^tdƒ‚d S )NTFúSSL support is not present)r   ÚTLSMemoryBIOFactoryr¢   r   rˆ   r)   r‡   )	r-   r¡   r|   rŠ   ÚcontextFactoryr‹   r”   Ú
tlsFactoryrŒ   r/   r/   r0   Ú
connectSSLù  s           ÿzPosixReactorBase.connectSSLc                 C   sh   t d k	r0t  |d|¡}|  ||||¡}d|_|S td k	rXt |||||| ¡}| ¡  |S dsdtdƒ‚d S )NFZTLSr£   )r   r¤   r    Z_typer   rz   r{   r‡   )r-   r|   rŠ   r¥   r   r~   r¦   r€   r/   r/   r0   Ú	listenSSL  s"         ÿzPosixReactorBase.listenSSLc                 C   sJ   t |ƒ| j }|D ]}|  |¡ qt |ƒ}|D ]}|  |¡ q.t||B ƒS )ag  
        Remove all readers and writers, and list of removed L{IReadDescriptor}s
        and L{IWriteDescriptor}s.

        Meant for calling from subclasses, to implement removeAll, like::

          def removeAll(self):
              return self._removeAll(self._reads, self._writes)

        where C{self._reads} and C{self._writes} are iterables.
        )Úsetrh   r\   r`   Úlist)r-   ZreadersZwritersZremovedReadersr.   ZremovedWritersÚwriterr/   r/   r0   Ú
_removeAll  s    zPosixReactorBase._removeAll)ry   r:   )ry   r:   F)rƒ   r   )rŽ   r   r   )r:   r   )r:   r   N)r:   )rŽ   ry   )rƒ   N)rƒ   N)rŽ   ry   )rA   rB   rC   rD   Ú_Wakerrg   rk   rn   rl   ro   rx   r   r‚   r   r’   r“   r•   r†   r'   r(   rž   r˜   r–   rœ   r   rŸ   r    r¢   r§   r¨   r¬   r/   r/   r/   r0   rf     sT   	    þ
#



	  ÿ
    ÿ
  ÿ ÿ ÿ




rf   c                   @   s   e Zd ZdZdd„ ZdS )Ú_PollLikeMixina¤  
    Mixin for poll-like reactors.

    Subclasses must define the following attributes::

      - _POLL_DISCONNECTED - Bitmask for events indicating a connection was
        lost.
      - _POLL_IN - Bitmask for events indicating there is input to read.
      - _POLL_OUT - Bitmask for events indicating output can be written.

    Must be mixed in to a subclass of PosixReactorBase (for
    _disconnectSelectable).
    c                 C   s´   d}d}|| j @ r6|| j@ s6|| jkr0d}t}qžt}nhzF| ¡ dkrJt}n0|| j@ r`| ¡ }d}|sz|| j@ rz| 	¡ }d}W n    t
 ¡ d }t ¡  Y nX |r°|  |||¡ dS )zg
        fd is available for read or write, do the work and raise errors if
        necessary.
        NFTrX   r%   )Ú_POLL_DISCONNECTEDÚ_POLL_INZ_readsr   r   r,   Ú_NO_FILEDESCr<   Ú	_POLL_OUTZdoWriteÚsysÚexc_infor   Úerrre   )r-   rb   rQ   Zeventrc   ZinReadr/   r/   r0   Ú_doReadOrWrite<  s*    

z_PollLikeMixin._doReadOrWriteN)rA   rB   rC   rD   r¶   r/   r/   r/   r0   r®   -  s   r®   c                   @   s|   e Zd ZdZdZdZdZdd„ Zdd„ Zd	d
„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZdS )Ú_ContinuousPollinga£  
    Schedule reads and writes based on the passage of time, rather than
    notification.

    This is useful for supporting polling filesystem files, which C{epoll(7)}
    does not support.

    The implementation uses L{_PollLikeMixin}, which is a bit hacky, but
    re-implementing and testing the relevant code yet again is unappealing.

    @ivar _reactor: The L{EPollReactor} that is using this instance.

    @ivar _loop: A C{LoopingCall} that drives the polling, or L{None}.

    @ivar _readers: A C{set} of C{FileDescriptor} objects that should be read
        from.

    @ivar _writers: A C{set} of C{FileDescriptor} objects that should be
        written to.
    r%   é   é   c                 C   s    || _ d | _tƒ | _tƒ | _d S r=   )Ú_reactorÚ_loopr©   Ú_readersÚ_writersrM   r/   r/   r0   r1   ”  s    z_ContinuousPolling.__init__c                 C   sh   | j s| jrN| jdkrdddlm}m} || jƒ| _| j| j_| jj	|dd n| jrd| j 
¡  d| _dS )zh
        Start or stop a C{LoopingCall} based on whether there are readers and
        writers.
        Nr   )ÚLoopingCallÚ_EPSILONF)Znow)r¼   r½   r»   Ztwisted.internet.taskr¾   r¿   Úiteraterº   ZclockÚstartÚstop)r-   r¾   r¿   r/   r/   r0   Ú
_checkLoop›  s    


z_ContinuousPolling._checkLoopc                 C   sD   t | jƒD ]}|  ||| j¡ q
t | jƒD ]}|  ||| j¡ q*dS )zX
        Call C{doRead} and C{doWrite} on all readers and writers respectively.
        N)rª   r¼   r¶   r°   r½   r²   )r-   r.   r«   r/   r/   r0   rÀ   ­  s    z_ContinuousPolling.iteratec                 C   s   | j  |¡ |  ¡  dS )zU
        Add a C{FileDescriptor} for notification of data available to read.
        N)r¼   ri   rÃ   ©r-   r.   r/   r/   r0   rj   ·  s    z_ContinuousPolling.addReaderc                 C   s   | j  |¡ |  ¡  dS )zV
        Add a C{FileDescriptor} for notification of data available to write.
        N)r½   ri   rÃ   ©r-   r«   r/   r/   r0   Ú	addWriter¿  s    z_ContinuousPolling.addWriterc                 C   s4   z| j  |¡ W n tk
r&   Y dS X |  ¡  dS )zY
        Remove a C{FileDescriptor} from notification of data available to read.
        N)r¼   ÚremoveÚKeyErrorrÃ   rÄ   r/   r/   r0   r\   Ç  s
    z_ContinuousPolling.removeReaderc                 C   s4   z| j  |¡ W n tk
r&   Y dS X |  ¡  dS )zb
        Remove a C{FileDescriptor} from notification of data available to
        write.
        N)r½   rÇ   rÈ   rÃ   rÅ   r/   r/   r0   r`   Ò  s
    z_ContinuousPolling.removeWriterc                 C   s(   t | j| jB ƒ}| j ¡  | j ¡  |S )z1
        Remove all readers and writers.
        )rª   r¼   r½   Úclear)r-   Úresultr/   r/   r0   Ú	removeAllÞ  s    

z_ContinuousPolling.removeAllc                 C   s
   t | jƒS )z/
        Return a list of the readers.
        )rª   r¼   r;   r/   r/   r0   Ú
getReadersê  s    z_ContinuousPolling.getReadersc                 C   s
   t | jƒS )z/
        Return a list of the writers.
        )rª   r½   r;   r/   r/   r0   Ú
getWritersñ  s    z_ContinuousPolling.getWritersc                 C   s
   || j kS )aj  
        Checks if the file descriptor is currently being observed for read
        readiness.

        @param fd: The file descriptor being checked.
        @type fd: L{twisted.internet.abstract.FileDescriptor}
        @return: C{True} if the file descriptor is being observed for read
            readiness, C{False} otherwise.
        @rtype: C{bool}
        )r¼   ©r-   rQ   r/   r/   r0   Ú	isReadingø  s    z_ContinuousPolling.isReadingc                 C   s
   || j kS )al  
        Checks if the file descriptor is currently being observed for write
        readiness.

        @param fd: The file descriptor being checked.
        @type fd: L{twisted.internet.abstract.FileDescriptor}
        @return: C{True} if the file descriptor is being observed for write
            readiness, C{False} otherwise.
        @rtype: C{bool}
        )r½   rÎ   r/   r/   r0   Ú	isWriting  s    z_ContinuousPolling.isWritingN)rA   rB   rC   rD   r¯   r°   r²   r1   rÃ   rÀ   rj   rÆ   r\   r`   rË   rÌ   rÍ   rÏ   rÐ   r/   r/   r/   r0   r·   w  s    
r·   Zfromfd)CrD   Z
__future__r   r   r'   r6   rJ   r³   Zzope.interfacer   r   Ztwisted.internetr   r   r   Ztwisted.internet.baser	   r
   Ztwisted.internet.mainr   r   Ztwisted.internet.interfacesr   r   r   r   r   r   r   r   r   r   Ztwisted.pythonr   r   r   Ztwisted.python.runtimer   r   ZConnectionFdescWentAwayZ
_NO_FILENOr±   Ztwisted.protocolsr   ÚImportErrorr   r†   rm   r   r    r!   r"   Z	isWindowsrr   ZLoggerr#   ÚobjectrF   rR   r­   rU   r[   rf   r®   r·   ÚgetattrÚ__all__r/   r/   r/   r0   Ú<module>   sz   0



24
(
ÿ  (J 


