use flow controller for window update handling, remove windowUpdateMgr

This commit is contained in:
Lucas Clemente 2016-07-11 14:54:32 +02:00
parent e303a7f578
commit f04d14ac3e
8 changed files with 72 additions and 269 deletions

View file

@ -14,7 +14,6 @@ import (
)
type streamHandler interface {
updateReceiveFlowControlWindow(streamID protocol.StreamID, byteOffset protocol.ByteCount) error
scheduleSending()
}
@ -132,7 +131,6 @@ func (s *stream) Read(p []byte) (int, error) {
s.readOffset += protocol.ByteCount(m)
s.flowControlManager.AddBytesRead(s.streamID, protocol.ByteCount(m))
s.maybeTriggerWindowUpdate()
if s.readPosInFrame >= int(frame.DataLen()) {
fin := frame.FinBit
@ -250,25 +248,6 @@ func (s *stream) CloseRemote(offset protocol.ByteCount) {
s.AddStreamFrame(&frames.StreamFrame{FinBit: true, Offset: offset})
}
func (s *stream) maybeTriggerWindowUpdate() error {
// check for stream level window updates
doUpdate, byteOffset, err := s.flowControlManager.MaybeTriggerStreamWindowUpdate(s.streamID)
if err != nil {
return err
}
if doUpdate {
s.session.updateReceiveFlowControlWindow(s.streamID, byteOffset)
}
// check for connection level window updates
doUpdate, byteOffset = s.flowControlManager.MaybeTriggerConnectionWindowUpdate()
if doUpdate {
s.session.updateReceiveFlowControlWindow(0, byteOffset)
}
return nil
}
// RegisterError is called by session to indicate that an error occurred and the
// stream should be closed.
func (s *stream) RegisterError(err error) {