MCPcopy Index your code
hub / github.com/subtrace/subtrace / copyRawSingle

Method copyRawSingle

cmd/run/socket/proxy.go:1347–1361  ·  view source on GitHub ↗
(dir, proto string, w io.Writer, r io.Reader)

Source from the content-addressed store, hash-verified

1345}
1346
1347func (p *proxy) copyRawSingle(dir, proto string, w io.Writer, r io.Reader) error {
1348 n, err := io.Copy(w, r)
1349 dur := time.Since(p.begin).Nanoseconds() / 1000
1350 switch {
1351 case err == nil:
1352 case errors.Is(err, net.ErrClosed):
1353 case errors.Is(err, unix.ECONNRESET):
1354 case errors.Is(err, unix.EPIPE):
1355 default:
1356 slog.Debug(fmt.Sprintf("copied bytes %s", dir), "proxy", p, "proto", proto, "bytes", n, "duration", dur, "err", err)
1357 return err
1358 }
1359 slog.Debug(fmt.Sprintf("copied bytes %s", dir), "proxy", p, "proto", proto, "bytes", n, "duration", dur)
1360 return nil
1361}
1362
1363// bufConn is a net.Conn wrapper that supports peeking on the read side.
1364type bufConn struct {

Callers 2

proxyHTTP1Method · 0.95
proxyFallbackMethod · 0.95

Calls 1

CopyMethod · 0.80

Tested by

no test coverage detected