MCPcopy
hub / github.com/XTLS/REALITY / Read

Method Read

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

Source from the content-addressed store, hash-verified

847}
848
849func (r *atLeastReader) Read(p []byte) (int, error) {
850 if r.N <= 0 {
851 return 0, io.EOF
852 }
853 n, err := r.R.Read(p)
854 r.N -= int64(n) // won't underflow unless len(p) >= n > 9223372036854775809
855 if r.N > 0 && err == io.EOF {
856 return n, io.ErrUnexpectedEOF
857 }
858 if r.N <= 0 && err == nil {
859 return n, io.EOF
860 }
861 return n, err
862}
863
864// readFromUntil reads from r into c.rawInput until c.rawInput contains
865// 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