implement basic FlowControlManager

This commit is contained in:
Marten Seemann
2016-06-15 18:53:54 +07:00
parent 37e57c6f05
commit 800320ec39
5 changed files with 250 additions and 5 deletions

View File

@@ -35,24 +35,24 @@ var _ = Describe("Flow controller", func() {
})
It("reads the stream send and receive windows when acting as stream-level flow controller", func() {
fc := NewFlowController(5, cpm).(*flowController)
fc := NewFlowController(5, cpm)
Expect(fc.streamID).To(Equal(protocol.StreamID(5)))
Expect(fc.receiveFlowControlWindow).To(Equal(protocol.ByteCount(2000)))
})
It("reads the stream send and receive windows when acting as stream-level flow controller", func() {
fc := NewFlowController(0, cpm).(*flowController)
fc := NewFlowController(0, cpm)
Expect(fc.streamID).To(Equal(protocol.StreamID(0)))
Expect(fc.receiveFlowControlWindow).To(Equal(protocol.ByteCount(4000)))
})
It("does not set the stream flow control windows for sending", func() {
fc := NewFlowController(5, cpm).(*flowController)
fc := NewFlowController(5, cpm)
Expect(fc.sendFlowControlWindow).To(BeZero())
})
It("does not set the connection flow control windows for sending", func() {
fc := NewFlowController(0, cpm).(*flowController)
fc := NewFlowController(0, cpm)
Expect(fc.sendFlowControlWindow).To(BeZero())
})
})