MCPcopy Create free account
hub / github.com/cloudwego/netpoll / Read

Method Read

connection_impl.go:327–335  ·  view source on GitHub ↗

------------------------------------------ implement net.Conn ------------------------------------------ Read behavior is the same as net.Conn, it will return io.EOF if buffer is empty.

(p []byte)

Source from the content-addressed store, hash-verified

325
326// Read behavior is the same as net.Conn, it will return io.EOF if buffer is empty.
327func (c *connection) Read(p []byte) (n int, err error) {
328 if len(p) == 0 {
329 return 0, nil
330 }
331 if err = c.waitRead(1); err != nil {
332 return 0, err
333 }
334 return c.inputBuffer.readCopy(p), nil
335}
336
337// Write will Flush soon.
338func (c *connection) Write(p []byte) (n int, err error) {

Callers 1

TestConnectionIOReaderFunction · 0.95

Calls 2

waitReadMethod · 0.95
readCopyMethod · 0.45

Tested by 1

TestConnectionIOReaderFunction · 0.76