summaryrefslogtreecommitdiffstats
path: root/Doc/library/asyncio-protocol.rst
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2018-05-28 18:31:28 (GMT)
committerGitHub <noreply@github.com>2018-05-28 18:31:28 (GMT)
commitdbf102271fcc316f353c7e0a283811b661d128f2 (patch)
tree8807a0305490616dc3b480fae5e50e98c80b4fa8 /Doc/library/asyncio-protocol.rst
parente549c4be5fb010f5faf12236af8faa720a1429be (diff)
downloadcpython-dbf102271fcc316f353c7e0a283811b661d128f2.zip
cpython-dbf102271fcc316f353c7e0a283811b661d128f2.tar.gz
cpython-dbf102271fcc316f353c7e0a283811b661d128f2.tar.bz2
bpo-33654: Support BufferedProtocol in set_protocol() and start_tls() (GH-7130)
In this commit: * Support BufferedProtocol in set_protocol() and start_tls() * Fix proactor to cancel readers reliably * Update tests to be compatible with OpenSSL 1.1.1 * Clarify BufferedProtocol docs * Bump TLS tests timeouts to 60 seconds; eliminate possible race from start_serving * Rewrite test_start_tls_server_1
Diffstat (limited to 'Doc/library/asyncio-protocol.rst')
-rw-r--r--Doc/library/asyncio-protocol.rst17
1 files changed, 12 insertions, 5 deletions
diff --git a/Doc/library/asyncio-protocol.rst b/Doc/library/asyncio-protocol.rst
index ef64416..9a08a4a 100644
--- a/Doc/library/asyncio-protocol.rst
+++ b/Doc/library/asyncio-protocol.rst
@@ -463,16 +463,23 @@ The idea of BufferedProtocol is that it allows to manually allocate
and control the receive buffer. Event loops can then use the buffer
provided by the protocol to avoid unnecessary data copies. This
can result in noticeable performance improvement for protocols that
-receive big amounts of data. Sophisticated protocols can allocate
-the buffer only once at creation time.
+receive big amounts of data. Sophisticated protocols implementations
+can allocate the buffer only once at creation time.
The following callbacks are called on :class:`BufferedProtocol`
instances:
-.. method:: BufferedProtocol.get_buffer()
+.. method:: BufferedProtocol.get_buffer(sizehint)
- Called to allocate a new receive buffer. Must return an object
- that implements the :ref:`buffer protocol <bufferobjects>`.
+ Called to allocate a new receive buffer.
+
+ *sizehint* is a recommended minimal size for the returned
+ buffer. It is acceptable to return smaller or bigger buffers
+ than what *sizehint* suggests. When set to -1, the buffer size
+ can be arbitrary. It is an error to return a zero-sized buffer.
+
+ Must return an object that implements the
+ :ref:`buffer protocol <bufferobjects>`.
.. method:: BufferedProtocol.buffer_updated(nbytes)