MCPcopy Create free account
hub / github.com/imroc/req / endStream

Method endStream

internal/http2/transport.go:2868–2882  ·  view source on GitHub ↗
(cs *clientStream)

Source from the content-addressed store, hash-verified

2866}
2867
2868func (rl *clientConnReadLoop) endStream(cs *clientStream) {
2869 // TODO: check that any declared content-length matches, like
2870 // server.go's (*stream).endStream method.
2871 if !cs.readClosed {
2872 cs.readClosed = true
2873 // Close cs.bufPipe and cs.peerClosed with cc.mu held to avoid a
2874 // race condition: The caller can read io.EOF from Response.Body
2875 // and close the body before we close cs.peerClosed, causing
2876 // cleanupWriteRequest to send a RST_STREAM.
2877 rl.cc.mu.Lock()
2878 defer rl.cc.mu.Unlock()
2879 cs.bufPipe.closeWithErrorAndCode(io.EOF, cs.copyTrailers)
2880 close(cs.peerClosed)
2881 }
2882}
2883
2884func (rl *clientConnReadLoop) endStreamError(cs *clientStream, err error) {
2885 cs.readAborted = true

Callers 3

processHeadersMethod · 0.95
processTrailersMethod · 0.95
processDataMethod · 0.95

Calls 3

LockMethod · 0.80
UnlockMethod · 0.80
closeWithErrorAndCodeMethod · 0.80

Tested by

no test coverage detected