Skip to content

[3.9] bpo-46487: Add get_write_buffer_limits to Write and _SSLProtocol transports (GH-30958) #31056

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

Merged
merged 1 commit into from
Feb 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Lib/asyncio/sslproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,12 @@ def get_write_buffer_size(self):
"""Return the current size of the write buffer."""
return self._ssl_protocol._transport.get_write_buffer_size()

def get_write_buffer_limits(self):
"""Get the high and low watermarks for write flow control.
Return a tuple (low, high) where low and high are
positive number of bytes."""
return self._ssl_protocol._transport.get_write_buffer_limits()

@property
def _protocol_paused(self):
# Required for sendfile fallback pause_writing/resume_writing logic
Expand Down
6 changes: 6 additions & 0 deletions Lib/asyncio/transports.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ def get_write_buffer_size(self):
"""Return the current size of the write buffer."""
raise NotImplementedError

def get_write_buffer_limits(self):
"""Get the high and low watermarks for write flow control.
Return a tuple (low, high) where low and high are
positive number of bytes."""
raise NotImplementedError

def write(self, data):
"""Write some data bytes to the transport.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add the ``get_write_buffer_limits`` method to :class:`asyncio.transports.WriteTransport` and to the SSL transport.