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

Method Until

connection_impl.go:198–215  ·  view source on GitHub ↗

Until implements Connection.

(delim byte)

Source from the content-addressed store, hash-verified

196
197// Until implements Connection.
198func (c *connection) Until(delim byte) (line []byte, err error) {
199 var n, l int
200 for {
201 if err = c.waitRead(n + 1); err != nil {
202 // return all the data in the buffer
203 line, _ = c.inputBuffer.Next(c.inputBuffer.Len())
204 return
205 }
206
207 l = c.inputBuffer.Len()
208 i := c.inputBuffer.indexByte(delim, n)
209 if i < 0 {
210 n = l // skip all exists bytes
211 continue
212 }
213 return c.Next(i + 1)
214 }
215}
216
217// ReadString implements Connection.
218func (c *connection) ReadString(n int) (s string, err error) {

Callers

nothing calls this directly

Calls 5

waitReadMethod · 0.95
NextMethod · 0.95
NextMethod · 0.65
LenMethod · 0.65
indexByteMethod · 0.45

Tested by

no test coverage detected