MCPcopy Index your code
hub / github.com/python/cpython / ServerProto

Class ServerProto

Lib/test/test_asyncio/test_sslproto.py:590–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

588 sock.close()
589
590 class ServerProto(asyncio.Protocol):
591 def __init__(self, on_con, on_con_lost, on_got_hello):
592 self.on_con = on_con
593 self.on_con_lost = on_con_lost
594 self.on_got_hello = on_got_hello
595 self.data = b''
596 self.transport = None
597
598 def connection_made(self, tr):
599 self.transport = tr
600 self.on_con.set_result(tr)
601
602 def replace_transport(self, tr):
603 self.transport = tr
604
605 def data_received(self, data):
606 self.data += data
607 if len(self.data) >= len(HELLO_MSG):
608 self.on_got_hello.set_result(None)
609
610 def connection_lost(self, exc):
611 self.transport = None
612 if exc is None:
613 self.on_con_lost.set_result(None)
614 else:
615 self.on_con_lost.set_exception(exc)
616
617 async def main(proto, on_con, on_con_lost, on_got_hello):
618 tr = await on_con

Callers 1

run_mainMethod · 0.70

Calls

no outgoing calls

Tested by 1

run_mainMethod · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…