Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-41279: Add StreamReaderBufferedProtocol #21446

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Commits on Jul 8, 2022

  1. bpo-41279: Add StreamReaderBufferedProtocol (pythonGH-21446)

    This class gets better performance as BufferedProtocol uses read_into
    into a buffer allocated before, instead of allocating a new buffer
    each time read is called.
    tontinton committed Jul 8, 2022
    Configuration menu
    Copy the full SHA
    9a65cfe View commit details
    Browse the repository at this point in the history
  2. bpo-41279: Add support for BufferedProtocol in _UnixReadPipeTransport (

    …pythonGH-21446)
    
    The transport did not know how to use the proper api exported by
    BufferedProtocol.
    
    Added a new callback function that calls getbuffer() and
    buffer_updated() instead of data_received() when the protocol given to
    it is of type BufferedProtocol.
    
    This is exactly the same way _SelectorSocketTransport handles a
    BufferedProtocol.
    tontinton committed Jul 8, 2022
    Configuration menu
    Copy the full SHA
    6db642c View commit details
    Browse the repository at this point in the history
  3. bpo-41279: Add support for BufferedProtocol in _ProactorReadPipeTrans…

    …port (pythonGH-21446)
    
    In the __init__ function if the protocol is of instance BufferedProtocol
    instead of creating a buffer object, we call get_buffer on the protocol
    to get its buffer.
    
    In addition _loop_reading now calls _data_received as soon as there is
    actual data instead of calling only after adding a recv_into event.
    
    The reason for this change is because read_into could call it's callback
    immediatly meaning overriding the data on the buffer before we actually
    call _data_received on it, which fixes the potential issue of missed data.
    tontinton committed Jul 8, 2022
    Configuration menu
    Copy the full SHA
    71d6a90 View commit details
    Browse the repository at this point in the history
  4. bpo-41279: Support resetting a protocol in _ProactorReadPipeTransport (

    …pythonGH-21446)
    
    When calling set_protocol to change the protocol you can now change the
    type of the protocol from BufferedProtocol to Protocol or vice versa.
    
    start_tls needed this feature as it could read into a buffered protocol
    at first and then change the protocol to SSLProto which is a regular
    protocol.
    tontinton committed Jul 8, 2022
    Configuration menu
    Copy the full SHA
    cdc14d8 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    9e81f1a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3dc4d18 View commit details
    Browse the repository at this point in the history