Skip to content

Commit

Permalink
transport: refactor trInFlow.onData to eliminate redundant logic (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
luxcgo authored Oct 16, 2024
1 parent 6cd00c9 commit ec10e73
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions internal/transport/flowcontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,11 @@ func (f *trInFlow) newLimit(n uint32) uint32 {

func (f *trInFlow) onData(n uint32) uint32 {
f.unacked += n
if f.unacked >= f.limit/4 {
w := f.unacked
f.unacked = 0
if f.unacked < f.limit/4 {
f.updateEffectiveWindowSize()
return w
return 0
}
f.updateEffectiveWindowSize()
return 0
return f.reset()
}

func (f *trInFlow) reset() uint32 {
Expand Down

0 comments on commit ec10e73

Please sign in to comment.