]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-46487: Add `get_write_buffer_limits` to Write and _SSLProtocol transports (GH...
authorEmiya <importz750@gmail.com>
Tue, 1 Feb 2022 16:05:02 +0000 (21:35 +0530)
committerGitHub <noreply@github.com>
Tue, 1 Feb 2022 16:05:02 +0000 (18:05 +0200)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Lib/asyncio/sslproto.py
Lib/asyncio/transports.py
Misc/NEWS.d/next/Library/2022-01-27-12-24-38.bpo-46487.UDkN2z.rst [new file with mode: 0644]

index cad25b26539f5aa930684eb664b1bdf9fd4c9f82..00fc16c014c9b2d666e81d7085860df8a62dd67c 100644 (file)
@@ -367,6 +367,12 @@ class _SSLProtocolTransport(transports._FlowControlMixin,
         """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
index 45e155c94cad1b31fb48e12a2098ba41138f4d31..73b1fa2de416c7012518df6306ba0845e49d3eaf 100644 (file)
@@ -99,6 +99,12 @@ class WriteTransport(BaseTransport):
         """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.
 
diff --git a/Misc/NEWS.d/next/Library/2022-01-27-12-24-38.bpo-46487.UDkN2z.rst b/Misc/NEWS.d/next/Library/2022-01-27-12-24-38.bpo-46487.UDkN2z.rst
new file mode 100644 (file)
index 0000000..adbc50a
--- /dev/null
@@ -0,0 +1 @@
+Add the ``get_write_buffer_limits`` method to :class:`asyncio.transports.WriteTransport` and to the SSL transport.