MCPcopy Create free account
hub / github.com/codeaashu/claude-code / drain

Function drain

src/upstreamproxy/relay.ts:215–226  ·  view source on GitHub ↗
(sock)

Source from the content-addressed store, hash-verified

213 handleData(adapter, st, data, wsUrl, authHeader, wsAuthHeader)
214 },
215 drain(sock) {
216 const st = sock.data
217 while (st.writeBuf.length > 0) {
218 const chunk = st.writeBuf[0]!
219 const n = sock.write(chunk)
220 if (n < chunk.length) {
221 st.writeBuf[0] = chunk.subarray(n)
222 return
223 }
224 st.writeBuf.shift()
225 }
226 },
227 close(sock) {
228 cleanupConn(sock.data)
229 },

Callers

nothing calls this directly

Calls 2

shiftMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected