bpo-41332: Added missing connect_accepted_socket() to AbstractEventLoop (GH-21533)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Kyle Stanley <aeros167@gmail.com>
This commit is contained in:
Alex Grönholm 2020-11-26 12:09:12 +02:00 committed by GitHub
parent f533cb80cb
commit e3ef4d7f65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 8 deletions

View File

@ -1525,14 +1525,6 @@ class BaseEventLoop(events.AbstractEventLoop):
self, protocol_factory, sock, self, protocol_factory, sock,
*, ssl=None, *, ssl=None,
ssl_handshake_timeout=None): ssl_handshake_timeout=None):
"""Handle an accepted connection.
This is used by servers that accept connections outside of
asyncio but that use asyncio to handle connections.
This method is a coroutine. When completed, the coroutine
returns a (transport, protocol) pair.
"""
if sock.type != socket.SOCK_STREAM: if sock.type != socket.SOCK_STREAM:
raise ValueError(f'A Stream Socket was expected, got {sock!r}') raise ValueError(f'A Stream Socket was expected, got {sock!r}')

View File

@ -418,6 +418,20 @@ class AbstractEventLoop:
""" """
raise NotImplementedError raise NotImplementedError
async def connect_accepted_socket(
self, protocol_factory, sock,
*, ssl=None,
ssl_handshake_timeout=None):
"""Handle an accepted connection.
This is used by servers that accept connections outside of
asyncio, but use asyncio to handle connections.
This method is a coroutine. When completed, the coroutine
returns a (transport, protocol) pair.
"""
raise NotImplementedError
async def create_datagram_endpoint(self, protocol_factory, async def create_datagram_endpoint(self, protocol_factory,
local_addr=None, remote_addr=None, *, local_addr=None, remote_addr=None, *,
family=0, proto=0, flags=0, family=0, proto=0, flags=0,

View File

@ -0,0 +1,2 @@
Added missing connect_accepted_socket() method to
``asyncio.AbstractEventLoop``.