remove the receive flow control window from the params negotiator

The receive windows are not negotiated, they are just announced to the
peer.
This commit is contained in:
Marten Seemann
2017-10-15 13:50:19 +07:00
parent f5acb690d3
commit 480db80da1
10 changed files with 45 additions and 96 deletions

View File

@@ -22,46 +22,46 @@ var _ = Describe("Flow controller", func() {
var rttStats *congestion.RTTStats
var mockPn *mocks.MockParamsNegotiator
receiveStreamWindow := protocol.ByteCount(2000)
receiveConnectionWindow := protocol.ByteCount(4000)
maxReceiveStreamWindow := protocol.ByteCount(8000)
maxReceiveConnectionWindow := protocol.ByteCount(9000)
BeforeEach(func() {
mockPn = mocks.NewMockParamsNegotiator(mockCtrl)
mockPn.EXPECT().GetSendStreamFlowControlWindow().AnyTimes().Return(protocol.ByteCount(1000))
mockPn.EXPECT().GetReceiveStreamFlowControlWindow().AnyTimes().Return(protocol.ByteCount(2000))
mockPn.EXPECT().GetSendConnectionFlowControlWindow().AnyTimes().Return(protocol.ByteCount(3000))
mockPn.EXPECT().GetReceiveConnectionFlowControlWindow().AnyTimes().Return(protocol.ByteCount(4000))
rttStats = &congestion.RTTStats{}
})
It("reads the stream send and receive windows when acting as stream-level flow controller", func() {
fc := newFlowController(5, true, mockPn, maxReceiveStreamWindow, rttStats)
fc := newFlowController(5, true, mockPn, receiveStreamWindow, maxReceiveStreamWindow, rttStats)
Expect(fc.streamID).To(Equal(protocol.StreamID(5)))
Expect(fc.receiveWindow).To(Equal(protocol.ByteCount(2000)))
Expect(fc.receiveWindow).To(Equal(receiveStreamWindow))
Expect(fc.maxReceiveWindowIncrement).To(Equal(maxReceiveStreamWindow))
})
It("reads the stream send and receive windows when acting as connection-level flow controller", func() {
fc := newFlowController(0, false, mockPn, maxReceiveConnectionWindow, rttStats)
fc := newFlowController(0, false, mockPn, receiveConnectionWindow, maxReceiveConnectionWindow, rttStats)
Expect(fc.streamID).To(Equal(protocol.StreamID(0)))
Expect(fc.receiveWindow).To(Equal(protocol.ByteCount(4000)))
Expect(fc.receiveWindow).To(Equal(receiveConnectionWindow))
Expect(fc.maxReceiveWindowIncrement).To(Equal(maxReceiveConnectionWindow))
})
It("does not set the stream flow control windows for sending", func() {
fc := newFlowController(5, true, mockPn, protocol.MaxByteCount, rttStats)
fc := newFlowController(5, true, mockPn, protocol.MaxByteCount, protocol.MaxByteCount, rttStats)
Expect(fc.sendWindow).To(BeZero())
})
It("does not set the connection flow control windows for sending", func() {
fc := newFlowController(0, false, mockPn, protocol.MaxByteCount, rttStats)
fc := newFlowController(0, false, mockPn, protocol.MaxByteCount, protocol.MaxByteCount, rttStats)
Expect(fc.sendWindow).To(BeZero())
})
It("says if it contributes to connection-level flow control", func() {
fc := newFlowController(1, false, mockPn, protocol.MaxByteCount, rttStats)
fc := newFlowController(1, false, mockPn, protocol.MaxByteCount, protocol.MaxByteCount, rttStats)
Expect(fc.ContributesToConnection()).To(BeFalse())
fc = newFlowController(5, true, mockPn, protocol.MaxByteCount, rttStats)
fc = newFlowController(5, true, mockPn, protocol.MaxByteCount, protocol.MaxByteCount, rttStats)
Expect(fc.ContributesToConnection()).To(BeTrue())
})
})