ЛР 7 — БВТ2301 — Парамонов — на 5 #14

Closed
gleb_paramonov wants to merge 4 commits from gleb_paramonov/mtusi2026lab7:solution/bvt2301-paramonov into main
Showing only changes of commit 0bf1ff93c7 - Show all commits
+6
View File
@@ -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))