forked from quic-go/quic-go
@@ -185,6 +185,8 @@ func (s *stream) Write(p []byte) (int, error) {
|
||||
dataWritten += dataLen
|
||||
s.flowController.AddBytesSent(protocol.ByteCount(dataLen))
|
||||
s.writeOffset += protocol.ByteCount(dataLen)
|
||||
|
||||
s.maybeTriggerBlocked()
|
||||
}
|
||||
|
||||
return len(p), nil
|
||||
|
||||
@@ -374,6 +374,23 @@ var _ = Describe("Stream", func() {
|
||||
Expect(handler.receivedBlockedCalled).To(BeTrue())
|
||||
Expect(handler.receivedBlockedForStream).To(Equal(str.streamID))
|
||||
})
|
||||
|
||||
It("notifies the session as soon as a stream is reaching the end of the window", func() {
|
||||
str.flowController.sendFlowControlWindow = 4
|
||||
str.Write([]byte{0xDE, 0xCA, 0xFB, 0xAD})
|
||||
Expect(handler.receivedBlockedCalled).To(BeTrue())
|
||||
Expect(handler.receivedBlockedForStream).To(Equal(str.streamID))
|
||||
})
|
||||
|
||||
It("notifies the session as soon as a stream is flow control blocked", func() {
|
||||
str.flowController.sendFlowControlWindow = 2
|
||||
go func() {
|
||||
str.Write([]byte{0xDE, 0xCA, 0xFB, 0xAD})
|
||||
}()
|
||||
time.Sleep(time.Millisecond)
|
||||
Expect(handler.receivedBlockedCalled).To(BeTrue())
|
||||
Expect(handler.receivedBlockedForStream).To(Equal(str.streamID))
|
||||
})
|
||||
})
|
||||
|
||||
Context("flow control window updating, for receiving", func() {
|
||||
|
||||
Reference in New Issue
Block a user