Commit 39a5ffd8 authored by Steven Allen's avatar Steven Allen

fix: don't change the receive window if we're forcing an update

Otherwise, our initial SYN/SYN-ACK packet will update the receive window
every time.
parent 6a03abfb
...@@ -1195,7 +1195,6 @@ func TestSession_PartialReadWindowUpdate(t *testing.T) { ...@@ -1195,7 +1195,6 @@ func TestSession_PartialReadWindowUpdate(t *testing.T) {
sendWindow := atomic.LoadUint32(&wr.sendWindow) sendWindow := atomic.LoadUint32(&wr.sendWindow)
if sendWindow != initialStreamWindow { if sendWindow != initialStreamWindow {
t.Errorf("sendWindow: exp=%d, got=%d", client.config.InitialStreamWindowSize, sendWindow) t.Errorf("sendWindow: exp=%d, got=%d", client.config.InitialStreamWindowSize, sendWindow)
return
} }
n, err := wr.Write(make([]byte, flood)) n, err := wr.Write(make([]byte, flood))
......
...@@ -214,8 +214,9 @@ func (s *Stream) sendWindowUpdate() error { ...@@ -214,8 +214,9 @@ func (s *Stream) sendWindowUpdate() error {
if !needed { if !needed {
return nil return nil
} }
now := time.Now() now := time.Now()
if rtt := s.session.getRTT(); rtt > 0 && now.Sub(s.epochStart) < rtt*4 { if rtt := s.session.getRTT(); flags == 0 && rtt > 0 && now.Sub(s.epochStart) < rtt*4 {
var recvWindow uint32 var recvWindow uint32
if s.recvWindow > math.MaxUint32/2 { if s.recvWindow > math.MaxUint32/2 {
recvWindow = min(math.MaxUint32, s.session.config.MaxStreamWindowSize) recvWindow = min(math.MaxUint32, s.session.config.MaxStreamWindowSize)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment