mirror of
https://github.com/python/cpython.git
synced 2025-10-07 15:42:02 +00:00
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 dbf102271f
)
Co-authored-by: Yury Selivanov <yury@magic.io>
This commit is contained in:
parent
f8fdb368e3
commit
bc3a002e7d
13 changed files with 382 additions and 69 deletions
|
@ -157,7 +157,6 @@ def _run_until_complete_cb(fut):
|
|||
futures._get_loop(fut).stop()
|
||||
|
||||
|
||||
|
||||
class _SendfileFallbackProtocol(protocols.Protocol):
|
||||
def __init__(self, transp):
|
||||
if not isinstance(transp, transports._FlowControlMixin):
|
||||
|
@ -304,6 +303,9 @@ class Server(events.AbstractServer):
|
|||
|
||||
async def start_serving(self):
|
||||
self._start_serving()
|
||||
# Skip one loop iteration so that all 'loop.add_reader'
|
||||
# go through.
|
||||
await tasks.sleep(0, loop=self._loop)
|
||||
|
||||
async def serve_forever(self):
|
||||
if self._serving_forever_fut is not None:
|
||||
|
@ -1363,6 +1365,9 @@ class BaseEventLoop(events.AbstractEventLoop):
|
|||
ssl, backlog, ssl_handshake_timeout)
|
||||
if start_serving:
|
||||
server._start_serving()
|
||||
# Skip one loop iteration so that all 'loop.add_reader'
|
||||
# go through.
|
||||
await tasks.sleep(0, loop=self)
|
||||
|
||||
if self._debug:
|
||||
logger.info("%r is serving", server)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue