send WindowUpdate frames

fixes #19
This commit is contained in:
Marten Seemann
2016-05-15 16:46:34 +07:00
parent 540941117e
commit a3ff4dd891
6 changed files with 115 additions and 27 deletions

View File

@@ -290,7 +290,7 @@ func (s *Session) handleWindowUpdateFrame(frame *frames.WindowUpdateFrame) error
return errWindowUpdateOnInvalidStream
}
stream.UpdateFlowControlWindow(frame.ByteOffset)
stream.UpdateSendFlowControlWindow(frame.ByteOffset)
return nil
}
@@ -454,7 +454,6 @@ func (s *Session) sendPacket() error {
}
}
stopWaitingFrame := s.stopWaitingManager.GetStopWaitingFrame()
ack, err := s.receivedPacketHandler.GetAckFrame(true)
if err != nil {
@@ -463,6 +462,8 @@ func (s *Session) sendPacket() error {
if ack != nil {
controlFrames = append(controlFrames, ack)
}
stopWaitingFrame := s.stopWaitingManager.GetStopWaitingFrame()
packet, err := s.packer.PackPacket(stopWaitingFrame, controlFrames, true)
if err != nil {
@@ -522,6 +523,16 @@ func (s *Session) QueueStreamFrame(frame *frames.StreamFrame) error {
return nil
}
// UpdateReceiveFlowControlWindow updates the flow control window for a stream
func (s *Session) UpdateReceiveFlowControlWindow(streamID protocol.StreamID, byteOffset protocol.ByteCount) error {
wuf := frames.WindowUpdateFrame{
StreamID: streamID,
ByteOffset: byteOffset,
}
s.packer.AddWindowUpdateFrame(&wuf)
return nil
}
// NewStream creates a new stream open for reading and writing
func (s *Session) NewStream(id protocol.StreamID) (utils.Stream, error) {
s.streamsMutex.Lock()