MCPcopy Create free account
hub / github.com/dgrr/http2 / writeData

Function writeData

conn.go:614–633  ·  view source on GitHub ↗
(bw *bufio.Writer, fh *FrameHeader, body []byte)

Source from the content-addressed store, hash-verified

612}
613
614func writeData(bw *bufio.Writer, fh *FrameHeader, body []byte) (err error) {
615 step := 1 << 14
616
617 data := AcquireFrame(FrameData).(*Data)
618 fh.SetBody(data)
619
620 for i := 0; err == nil && i < len(body); i += step {
621 if i+step >= len(body) {
622 step = len(body) - i
623 }
624
625 data.SetEndStream(i+step == len(body))
626 data.SetPadding(false)
627 data.SetData(body[i : step+i])
628
629 _, err = fh.WriteTo(bw)
630 }
631
632 return err
633}
634
635func (c *Conn) readNext() (fr *FrameHeader, err error) {
636loop:

Callers 2

testIssue52Function · 0.85
writeRequestMethod · 0.85

Calls 6

AcquireFrameFunction · 0.85
SetBodyMethod · 0.80
WriteToMethod · 0.80
SetEndStreamMethod · 0.45
SetPaddingMethod · 0.45
SetDataMethod · 0.45

Tested by 1

testIssue52Function · 0.68