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

Method proxy_to_backend

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

Source from the content-addressed store, hash-verified

311 return_exceptions=True)
312
313 async def proxy_to_backend(self):
314 buf = None
315
316 try:
317 while True:
318 await self.connectivity.wait()
319 if buf is not None:
320 data = buf
321 buf = None
322 else:
323 data = await self._read(self.client_sock, 4096)
324 if data == b'':
325 break
326 if self.connectivity_loss.is_set():
327 if data:
328 buf = data
329 continue
330 await self._write(self.backend_sock, data)
331
332 except ConnectionError:
333 pass
334
335 finally:
336 if not self.loop.is_closed():
337 self.loop.call_soon(self.close)
338
339 async def proxy_from_backend(self):
340 buf = None

Callers 1

handleMethod · 0.95

Calls 4

_readMethod · 0.95
_writeMethod · 0.95
waitMethod · 0.80
is_closedMethod · 0.80

Tested by

no test coverage detected