set offset in WindowUpdates based on read position and window increment

fixes #105
This commit is contained in:
Marten Seemann
2016-05-16 17:00:06 +07:00
parent de871f0a4f
commit 4de41d0737
2 changed files with 2 additions and 3 deletions

View File

@@ -138,7 +138,7 @@ func (s *stream) ReadByte() (byte, error) {
}
func (s *stream) updateReceiveFlowControlWindow() {
n := s.receiveFlowControlWindow + s.receiveFlowControlWindowIncrement
n := s.readOffset + s.receiveFlowControlWindowIncrement
s.receiveFlowControlWindow = n
s.session.updateReceiveFlowControlWindow(s.streamID, n)
}

View File

@@ -354,7 +354,6 @@ var _ = Describe("Stream", func() {
Context("flow control window updating, for receiving", func() {
It("updates the flow control window", func() {
len := int(protocol.WindowUpdateThreshold) + 1
receiveFlowControlWindow := str.receiveFlowControlWindow
frame := frames.StreamFrame{
Offset: 0,
Data: bytes.Repeat([]byte{'f'}, len),
@@ -364,7 +363,7 @@ var _ = Describe("Stream", func() {
n, err := str.Read(b)
Expect(err).ToNot(HaveOccurred())
Expect(n).To(Equal(len))
Expect(str.receiveFlowControlWindow).To(Equal(receiveFlowControlWindow + str.receiveFlowControlWindowIncrement))
Expect(str.receiveFlowControlWindow).To(Equal(protocol.ByteCount(len) + str.receiveFlowControlWindowIncrement))
})
It("does not update the flow control window when not enough data was received", func() {