(cs *clientStream)
| 2866 | } |
| 2867 | |
| 2868 | func (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 | |
| 2884 | func (rl *clientConnReadLoop) endStreamError(cs *clientStream, err error) { |
| 2885 | cs.readAborted = true |
no test coverage detected