Skip to content

Commit

Permalink
Fix FLOW_CONTROL_ERROR in ImpersonateXXX (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
imroc committed Aug 31, 2023
1 parent 16f0680 commit 7b2415b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions internal/http2/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,6 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro

cc.cond = sync.NewCond(&cc.mu)

var windowSize int32 = initialWindowSize
var headerTableSize uint32 = initialHeaderTableSize
for _, setting := range t.Settings {
switch setting.ID {
Expand All @@ -664,12 +663,10 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro
t.MaxHeaderListSize = setting.Val
case http2.SettingHeaderTableSize:
headerTableSize = setting.Val
case http2.SettingInitialWindowSize:
windowSize = int32(setting.Val)
}
}

cc.flow.add(windowSize)
cc.flow.add(initialWindowSize)

// TODO: adjust this writer size to account for frame size +
// MTU + crypto/tls record padding.
Expand Down Expand Up @@ -726,7 +723,7 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro
cc.nextStreamID = p.StreamID + 2
}

cc.inflow.init(int32(connFlow) + windowSize)
cc.inflow.init(int32(connFlow) + initialWindowSize)
cc.bw.Flush()
if cc.werr != nil {
cc.Close()
Expand Down

0 comments on commit 7b2415b

Please sign in to comment.