MCPcopy Create free account
hub / github.com/anthropics/defending-code-reference-harness / _pump

Method _pump

scripts/egress_proxy.py:53–74  ·  view source on GitHub ↗
(a: socket.socket, b: socket.socket)

Source from the content-addressed store, hash-verified

51
52 @staticmethod
53 def _pump(a: socket.socket, b: socket.socket) -> None:
54 a.setblocking(False)
55 b.setblocking(False)
56 try:
57 while True:
58 r, _, _ = select.select([a, b], [], [], 60)
59 if not r:
60 return
61 for src in r:
62 dst = b if src is a else a
63 data = src.recv(65536)
64 if not data:
65 return
66 dst.sendall(data)
67 except OSError:
68 pass
69 finally:
70 for s in (a, b):
71 try:
72 s.close()
73 except OSError:
74 pass
75
76 def log_message(self, format, *args): # noqa: A002 — base sig
77 pass

Callers 1

do_CONNECTMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected