Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
windows.cpython-313.pyc85 linesDownload Raw Back to __pycache__
1�

2��jt��8�SrSSKJr SSKJr Sr"SS5rg)	a3h2/windows4~~~~~~~~~~5 6Defines tools for managing HTTP/2 flow control windows.7 8The objects defined in this module are used to automatically manage HTTP/29flow control windows. Specifically, they keep track of what the size of the10window is, how much data has been consumed from that window, and how much data11the user has already used. It then implements a basic algorithm that attempts12to manage the flow control window without user input, trying to ensure that it13does not emit too many WINDOW_UPDATE frames.14�)�annotations�)�FlowControlErrori���c�J�\rSrSrSrS15SjrSSjrSSjrSSjrS
Sjr	Sr16g	)�
WindowManager�z�17A basic HTTP/2 window manager.18 19:param max_window_size: The maximum size of the flow control window.20:type max_window_size: ``int``21c�B�U[::deXlXlSUlg)Nr)�LARGEST_FLOW_CONTROL_WINDOW�max_window_size�current_window_size�_bytes_processed)�selfrs  �PD:\code\apps\devtools\python\user_packages\Python313\site-packages\h2/windows.py�__init__�WindowManager.__init__s%���"=�=�=�=�.��#2� � !���c�h�U=RU-slURS:a
Sn[U5eg)a22We have received a certain number of bytes from the remote peer. This23necessarily shrinks the flow control window!24 25:param size: The number of flow controlled bytes we received from the26    remote peer.27:type size: ``int``28:returns: Nothing.29:rtype: ``None``30rz"Flow control window shrunk below 0N)rr�r�size�msgs   r�window_consumed�WindowManager.window_consumed$s8��	
� � �D�(� ��#�#�a�'�6�C�"�3�'�'�(rc���U=RU-
slUR[:�aS[3n[U5e[URUR5Ulg)a�31The flow control window has been incremented, either because of manual32flow control management or because of the user changing the flow33control settings. This can have the effect of increasing what we34consider to be the "maximum" flow control window size.35 36This does not increase our view of how many bytes have been processed,37only of how much space is in the window.38 39:param size: The increment to the flow control window we received.40:type size: ``int``41:returns: Nothing42:rtype: ``None``43z#Flow control window mustn't exceed N)rr44r�maxrrs   r�
window_opened�WindowManager.window_opened4sX��	
� � �D�(� ��#�#�&A�A�7�8S�7T�U�C�"�3�'�'�"�4�#;�#;�T�=Q�=Q�R��rc�L�U=RU-
slUR5$)a�45The application has informed us that it has processed a certain number46of bytes. This may cause us to want to emit a window update frame. If47we do want to emit a window update frame, this method will return the48number of bytes that we should increment the window by.49 50:param size: The number of flow controlled bytes that the application51    has processed.52:type size: ``int``53:returns: The number of bytes to increment the flow control window by,54    or ``None``.55:rtype: ``int`` or ``None``56)r
�_maybe_update_window)rrs  r�
process_bytes�WindowManager.process_bytesKs$��	
����%���(�(�*�*rc�l�UR(dgURUR-57nSnURS:Xa'UR[SURS-5:�dURURS-:�a[URU5nSUlU=RU-
slU$)a�58Run the algorithm.59 60Our current algorithm can be described like this.61 621. If no bytes have been processed, we immediately return 0. There is63   no meaningful way for us to hand space in the window back to the64   remote peer, so let's not even try.652. If there is no space in the flow control window, and we have66   processed at least 1024 bytes (or 1/4 of the window, if the window67   is smaller), we will emit a window update frame. This is to avoid68   the risk of blocking a stream altogether.693. If there is space in the flow control window, and we have processed70   at least 1/2 of the window worth of bytes, we will emit a window71   update frame. This is to minimise the number of window update frames72   we have to emit.73 74In a healthy system with large flow control windows, this will75irregularly emit WINDOW_UPDATE frames. This prevents us starving the76connection by emitting eleventy bajillion WINDOW_UPDATE frames,77especially in situations where the remote peer is sending a lot of very78small DATA frames.79Nri��)r
rr�min)r�
max_increment�	increments   rr�"WindowManager._maybe_update_window\s���4�$�$���-�-��0H�0H�H�
��	�80�
%�
%��
*��%�%��D�$�2F�2F�!�2K�(L�L�RV�Rg�Rg�lp�mA�mA�EF�mF�SG��D�1�1�=�A�I�$%�D�!�� � �I�-� ��r)r
rrN)r�int�return�None)rr(r)r*)rr(r)�81int | None)r)r+)�__name__�82__module__�__qualname__�__firstlineno__�__doc__rrrrr�__static_attributes__�rrrrs!���"�(� S�.+�")rrN)r0�83__future__r�84exceptionsrr85rr2rr�<module>r5s&���#�(�(��o�or
codekingpro/portable-devtools · Team Ai