package util

Import Path
	github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/util (on go.dev)

Dependency Relation
	imports 9 packages, and imported by 2 packages

Involved Source Files io.go pbconv.go
Package-Level Type Names (only one)
/* sort by: | */
(*DelimitedReader) Close() (*DelimitedReader) ReadByte() (byte, error) (*DelimitedReader) ReadMsg(msg proto.Message) error *DelimitedReader : github.com/libp2p/go-msgio/pbio.Reader *DelimitedReader : io.ByteReader func NewDelimitedReader(r io.Reader, maxSize int) *DelimitedReader
Package-Level Functions (total 4)
The gogo protobuf NewDelimitedReader is buffered, which may eat up stream data. So we need to implement a compatible delimited reader that reads unbuffered. There is a slowdown from unbuffered reading: when reading the message it can take multiple single byte Reads to read the length and another Read to read the message payload. However, this is not critical performance degradation as - the reader is utilized to read one (dialer, stop) or two messages (hop) during the handshake, so it's a drop in the water for the connection lifetime. - messages are small (max 4k) and the length fits in a couple of bytes, so overall we have at most three reads per message.