diff --git a/stream.go b/stream.go index a97bacdca..bd5e778a6 100644 --- a/stream.go +++ b/stream.go @@ -118,6 +118,7 @@ func (s *stream) Read(p []byte) (int, error) { s.readOffset += protocol.ByteCount(m) s.flowControlManager.AddBytesRead(s.streamID, protocol.ByteCount(m)) + s.onData() // so that a possible WINDOW_UPDATE is sent if s.readPosInFrame >= int(frame.DataLen()) { fin := frame.FinBit diff --git a/stream_test.go b/stream_test.go index b5b2bd444..e83388b54 100644 --- a/stream_test.go +++ b/stream_test.go @@ -288,6 +288,17 @@ var _ = Describe("Stream", func() { Expect(err).To(MatchError(errOverlappingStreamData)) }) + It("calls onData", func() { + frame := frames.StreamFrame{ + Offset: 0, + Data: []byte{0xDE, 0xAD, 0xBE, 0xEF}, + } + str.AddStreamFrame(&frame) + b := make([]byte, 4) + _, err := str.Read(b) + Expect(err).ToNot(HaveOccurred()) + Expect(onDataCalled).To(BeTrue()) + }) }) Context("writing", func() {