diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-05-28 18:50:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-28 18:50:45 (GMT) |
commit | bc3a002e7d5a921e233a5ee0b0f5610c6510b647 (patch) | |
tree | 7ba7161a4106d7f50f925b1fdd04fbbc95579048 /Lib/asyncio/protocols.py | |
parent | f8fdb368e3d8d048bffc248fbe1023651c276671 (diff) | |
download | cpython-bc3a002e7d5a921e233a5ee0b0f5610c6510b647.zip cpython-bc3a002e7d5a921e233a5ee0b0f5610c6510b647.tar.gz cpython-bc3a002e7d5a921e233a5ee0b0f5610c6510b647.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
(cherry picked from commit dbf102271fcc316f353c7e0a283811b661d128f2)
Co-authored-by: Yury Selivanov <yury@magic.io>
Diffstat (limited to 'Lib/asyncio/protocols.py')
-rw-r--r-- | Lib/asyncio/protocols.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/asyncio/protocols.py b/Lib/asyncio/protocols.py index dc298a8..b8d2e6b 100644 --- a/Lib/asyncio/protocols.py +++ b/Lib/asyncio/protocols.py @@ -130,11 +130,15 @@ class BufferedProtocol(BaseProtocol): * CL: connection_lost() """ - def get_buffer(self): + def get_buffer(self, sizehint): """Called to allocate a new receive buffer. + *sizehint* is a recommended minimal size for the returned + buffer. When set to -1, the buffer size can be arbitrary. + Must return an object that implements the :ref:`buffer protocol <bufferobjects>`. + It is an error to return a zero-sized buffer. """ def buffer_updated(self, nbytes): @@ -185,7 +189,3 @@ class SubprocessProtocol(BaseProtocol): def process_exited(self): """Called when subprocess has exited.""" - - -def _is_buffered_protocol(proto): - return hasattr(proto, 'get_buffer') and not hasattr(proto, 'data_received') |