MCPcopy Create free account
hub / github.com/XTLS/Go / Read

Method Read

conn.go:882–895  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

880}
881
882func (r *atLeastReader) Read(p []byte) (int, error) {
883 if r.N <= 0 {
884 return 0, io.EOF
885 }
886 n, err := r.R.Read(p)
887 r.N -= int64(n) // won't underflow unless len(p) >= n > 9223372036854775809
888 if r.N > 0 && err == io.EOF {
889 return n, io.ErrUnexpectedEOF
890 }
891 if r.N <= 0 && err == nil {
892 return n, io.EOF
893 }
894 return n, err
895}
896
897// readFromUntil reads from r into c.rawInput until c.rawInput contains
898// at least n bytes or else returns an error.

Callers

nothing calls this directly

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected