Skip to content

Commit

Permalink
bpo-46487: Add get_write_buffer_limits to Write and _SSLProtocol tr…
Browse files Browse the repository at this point in the history
…ansports (GH-30958)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 64568ac)

Co-authored-by: Emiya <importz750@gmail.com>
  • Loading branch information
miss-islington and mooncell07 committed Feb 1, 2022
1 parent a22dd00 commit e4a6e54
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Lib/asyncio/sslproto.py
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
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
@@ -0,0 +1 @@
Add the ``get_write_buffer_limits`` method to :class:`asyncio.transports.WriteTransport` and to the SSL transport.

0 comments on commit e4a6e54

Please sign in to comment.