forked from mtusi2026/mtusi2026lab7
Pause accepted transport before scheduling TLS handshake
This commit is contained in:
@@ -77,6 +77,12 @@ async def serve(routes):
|
||||
if peer: peer.close()
|
||||
|
||||
def accept(reader, writer, route):
|
||||
# connection_made calls this synchronously. Pause before scheduling the
|
||||
# coroutine: otherwise StreamReader can consume ClientHello while that
|
||||
# coroutine waits in the event-loop queue. start_tls resumes the transport
|
||||
# after installing SSLProtocol. Outgoing local plaintext is unaffected.
|
||||
if route['mode'] == 'server':
|
||||
writer.transport.pause_reading()
|
||||
if len(tasks) >= 96:
|
||||
writer.close(); return
|
||||
task = asyncio.create_task(handle(reader, writer, route))
|
||||
|
||||
Reference in New Issue
Block a user