CasperSecurity

Current Path : /lib/python3/dist-packages/twisted/internet/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/twisted/internet/__pycache__/pollreactor.cpython-310.pyc

o

�bV�@s�dZddlZddlmZmZmZmZmZmZ	m
Z
ddlmZddl
mZddlmZddlmZee�Gdd	�d	ejej��Zd
d�Zd	dgZdS)z�
A poll() based implementation of the twisted main loop.

To install the event loop (and you should do this before any connections,
listeners or connectors are added)::

    from twisted.internet import pollreactor
    pollreactor.install()
�N)�POLLERR�POLLHUP�POLLIN�POLLNVAL�POLLOUT�error�poll)�implementer)�	posixbase)�
IReactorFDSet)�logc@s�eZdZdZeeBeBZeZ	e
Zdd�Zdd�Z
dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�ZeZdd�Zdd�ZdS)�PollReactora^
    A reactor that uses poll(2).

    @ivar _poller: A L{select.poll} which will be used to check for I/O
        readiness.

    @ivar _selectables: A dictionary mapping integer file descriptors to
        instances of L{FileDescriptor} which have been registered with the
        reactor.  All L{FileDescriptor}s which are currently receiving read or
        write readiness notifications will be present as values in this
        dictionary.

    @ivar _reads: A dictionary mapping integer file descriptors to arbitrary
        values (this is essentially a set).  Keys in this dictionary will be
        registered with C{_poller} for read readiness notifications which will
        be dispatched to the corresponding L{FileDescriptor} instances in
        C{_selectables}.

    @ivar _writes: A dictionary mapping integer file descriptors to arbitrary
        values (this is essentially a set).  Keys in this dictionary will be
        registered with C{_poller} for write readiness notifications which will
        be dispatched to the corresponding L{FileDescriptor} instances in
        C{_selectables}.
    cCs*t�|_i|_i|_i|_tj�|�dS)zo
        Initialize polling object, file descriptor tracking dictionaries, and
        the base class.
        N)r�_poller�_selectables�_reads�_writesr
�PosixReactorBase�__init__��self�r�>/usr/lib/python3/dist-packages/twisted/internet/pollreactor.pyrCs
zPollReactor.__init__cCs�z|j�|�Wn	tyYnwd}||jvr|tB}||jvr&|tB}|dkr3|j�||�dS||jvr>|j|=dSdS)z*Register/unregister an fd with the poller.rN)	r�
unregister�KeyErrorrrrr�registerr)r�fd�maskrrr�_updateRegistrationNs�


�zPollReactor._updateRegistrationcCsnz
|��}||Wnty&|j��D]
\}}||ur nqYdSYnw||vr5||=|�|�dSdS)N)�fileno�
BaseExceptionr�itemsr)r�
selectable�mdictr�fdesrrr�_dictRemove`s���
�zPollReactor._dictRemovecC�8|��}||jvr||j|<d|j|<|�|�dSdS)z@Add a FileDescriptor for notification of data available to read.�N)rrrr)r�readerrrrr�	addReaderu�


�zPollReactor.addReadercCr%)zAAdd a FileDescriptor for notification of data available to write.r&N)rrrr)r�writerrrrr�	addWriter}r)zPollReactor.addWritercC�|�||j�S)z?Remove a Selectable for notification of data available to read.)r$r)rr'rrr�removeReader��zPollReactor.removeReadercCr,)z@Remove a Selectable for notification of data available to write.)r$r)rr*rrr�removeWriter�r.zPollReactor.removeWritercs,���fdd��jD��fdd��jD��S)zD
        Remove all selectables, and return a list of them.
        c�g|]}�j|�qSr�r��.0rrrr�
<listcomp>��z)PollReactor.removeAll.<locals>.<listcomp>cr0rr1r2rrrr4�r5)�
_removeAllrrrrrr�	removeAll�s�zPollReactor.removeAllc
Cs�|dur
t|d�}z|j�|�}Wnty.}z|jdtjkr)WYd}~dS�d}~ww|j}|D]\}}z|j|}Wn	t	yHYq4wt
�|||||�q4dS)zPoll the poller for new events.Ni�r)�intrr�SelectError�args�errno�EINTR�_doReadOrWriterrr�callWithLogger)r�timeout�l�e�_drdwr�eventr!rrr�doPoll�s&����zPollReactor.doPollc��fdd��jD�S)Ncr0rr1r2rrrr4�r5z*PollReactor.getReaders.<locals>.<listcomp>)rrrrr�
getReaders��zPollReactor.getReaderscrE)Ncr0rr1r2rrrr4�r5z*PollReactor.getWriters.<locals>.<listcomp>)rrrrr�
getWriters�rGzPollReactor.getWritersN)�__name__�
__module__�__qualname__�__doc__rrr�_POLL_DISCONNECTEDr�_POLL_INr�	_POLL_OUTrrr$r(r+r-r/r7rD�doIterationrFrHrrrrr
$s"	r
cCst�}ddlm}||�dS)zInstall the poll() reactor.r)�installReactorN)r
�twisted.internet.mainrQ)�prQrrr�install�srT)rLr;�selectrrrrrrr9r�zope.interfacer	�twisted.internetr
�twisted.internet.interfacesr�twisted.pythonrr�_PollLikeMixinr
rT�__all__rrrr�<module>s$

Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY