MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / _start_thread

Method _start_thread

asyncpg/_testbase/fuzzer.py:74–94  ·  view source on GitHub ↗
(self, started_event)

Source from the content-addressed store, hash-verified

72 self.stop_event.set()
73
74 def _start_thread(self, started_event):
75 self.loop = asyncio.new_event_loop()
76 asyncio.set_event_loop(self.loop)
77
78 self.connectivity = asyncio.Event()
79 self.connectivity.set()
80 self.connectivity_loss = asyncio.Event()
81 self.stop_event = asyncio.Event()
82
83 if self.listening_port is None:
84 self.listening_port = cluster.find_available_port()
85
86 self.sock = socket.socket()
87 self.sock.bind((self.listening_addr, self.listening_port))
88 self.sock.listen(50)
89 self.sock.setblocking(False)
90
91 try:
92 self.loop.run_until_complete(self._main(started_event))
93 finally:
94 self.loop.close()
95
96 async def _main(self, started_event):
97 self.listen_task = asyncio.ensure_future(self.listen())

Callers

nothing calls this directly

Calls 3

_mainMethod · 0.95
listenMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected