Update msgrate.go

This commit is contained in:
Felix Lange 2025-08-07 16:12:29 +02:00 committed by cuiweixie
parent 888d4b7be6
commit cdf534bfb2

View file

@ -171,7 +171,7 @@ func (t *Tracker) Capacity(kind uint64, targetRTT time.Duration) int {
// roundCapacity gives the integer value of a capacity. // roundCapacity gives the integer value of a capacity.
// The result fits int32, and is guaranteed to be positive. // The result fits int32, and is guaranteed to be positive.
func roundCapacity(cap float64) int { func roundCapacity(cap float64) int {
return int(math.Min(math.MaxInt32, math.Max(1, math.Ceil(cap)))) return int(min(math.MaxInt32, max(1, math.Ceil(cap))))
} }
// Update modifies the peer's capacity values for a specific data type with a new // Update modifies the peer's capacity values for a specific data type with a new