Skip to content
Snippets Groups Projects
Unverified Commit c970092a authored by Jonney's avatar Jonney Committed by GitHub
Browse files

Compatible with Python 3.11

In Python 3.11, asyncio.sslproto.SSLProtocol inherits from asyncio.protocols.BufferedProtocol.
In SSLProtocol, data_received() is no longer used and has been replaced with get_buffer() and buffer_updated().
parent 7c967309
No related branches found
No related tags found
No related merge requests found
......@@ -616,12 +616,21 @@ def sslwrap(reader, writer, sslcontext, server_side=False, server_hostname=None,
self.close()
ssl.connection_made(Transport())
async def channel():
read_size=65536
buffer=None
if hasattr(ssl,'get_buffer'):
buffer=ssl.get_buffer(read_size)
try:
while not reader.at_eof() and not ssl._app_transport._closed:
data = await reader.read(65536)
data = await reader.read(read_size)
if not data:
break
ssl.data_received(data)
if buffer!=None:
data_len=len(data)
buffer[:data_len]=data
ssl.buffer_updated(data_len)
else:
ssl.data_received(data)
except Exception:
pass
finally:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment