http3: allow concurrent calls to Body.Close (#4798)

This commit is contained in:
RPRX
2024-12-28 02:52:17 +00:00
committed by GitHub
parent f6e7789854
commit 3552381374
2 changed files with 18 additions and 7 deletions

View File

@@ -54,6 +54,18 @@ var _ = Describe("Response Body", func() {
Expect(rb.Close()).To(Succeed())
})
It("allows concurrent calls to Close", func() {
str := mockquic.NewMockStream(mockCtrl)
rb := newResponseBody(&stream{Stream: str}, -1, reqDone)
str.EXPECT().CancelRead(quic.StreamErrorCode(ErrCodeRequestCanceled)).MaxTimes(2)
go func() {
defer GinkgoRecover()
Expect(rb.Close()).To(Succeed())
}()
Expect(rb.Close()).To(Succeed())
Expect(reqDone).To(BeClosed())
})
Context("length limiting", func() {
It("reads all frames", func() {
var buf bytes.Buffer