MCPcopy
hub / github.com/segmentio/kafka-go / Read

Method Read

conn_test.go:43–55  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

41}
42
43func (c *connPipe) Read(b []byte) (int, error) {
44 // See comments in Write.
45 time.Sleep(time.Millisecond)
46 if t := c.rconn.readDeadline(); !t.IsZero() {
47 return 0, &timeout{}
48 }
49 n, err := c.rconn.Read(b)
50 if n == 1 && b[0] == 0 {
51 c.rconn.Close()
52 n, err = 0, io.EOF
53 }
54 return n, err
55}
56
57func (c *connPipe) Write(b []byte) (int, error) {
58 // The nettest/ConcurrentMethods test spawns a bunch of goroutines that do

Calls 3

readDeadlineMethod · 0.80
IsZeroMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected