interceptor icon indicating copy to clipboard operation
interceptor copied to clipboard

GCC: RateController does not use the internal state

Open N1cOs opened this issue 1 year ago • 1 comments

Your environment.

  • Version: v0.1.30

What did you do?

RateController on the delay stats update doesn't use the internals state. Should we make a transition from the internal state, not from the current one (which is always increase actually)? Snippet from the rate_controller.go :

func (c *rateController) onDelayStats(ds DelayStats) {
	now := time.Now()

	if !c.init {
		c.delayStats = ds
		c.delayStats.State = stateIncrease
		c.init = true
		return
	}
	c.delayStats = ds
	// Transition from the current state?
	c.delayStats.State = c.delayStats.State.transition(ds.Usage)

	if c.delayStats.State == stateHold {
		return
	}

	// ... more logic
}

What did you expect?

Using the internal state (smth like this):

func (c *rateController) onDelayStats(ds DelayStats) {
	now := time.Now()

	if !c.init {
		c.delayStats = ds
		c.delayStats.State = stateIncrease
		c.init = true
		return
	}
	
	prev := c.delayStats
	c.delayStats = ds
	c.delayStats.State = prev.State.transition(ds.Usage)

	if c.delayStats.State == stateHold {
		return
	}

	// ... more logic
}

What happened?

N1cOs avatar Aug 09 '24 12:08 N1cOs

I noticed this same issue when doing a port of GCC for QUIC and was looking at different implementations.

sterlingdeng avatar Dec 21 '24 08:12 sterlingdeng