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

Method proxy_to_backend

asyncpg/_testbase/fuzzer.py:256–280  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

254 conn_event_task.cancel()
255
256 async def proxy_to_backend(self):
257 buf = None
258
259 try:
260 while True:
261 await self.connectivity.wait()
262 if buf is not None:
263 data = buf
264 buf = None
265 else:
266 data = await self._read(self.client_sock, 4096)
267 if data == b'':
268 break
269 if self.connectivity_loss.is_set():
270 if data:
271 buf = data
272 continue
273 await self._write(self.backend_sock, data)
274
275 except ConnectionError:
276 pass
277
278 finally:
279 if not self.loop.is_closed():
280 self.loop.call_soon(self.close)
281
282 async def proxy_from_backend(self):
283 buf = None

Callers 1

handleMethod · 0.95

Calls 3

_readMethod · 0.95
_writeMethod · 0.95
is_closedMethod · 0.80

Tested by

no test coverage detected