OpenMetaverse.TokenBucket.Drip C# (CSharp) Méthode

Drip() private méthode

Add tokens to the bucket over time. The number of tokens added each call depends on the length of time that has passed since the last call to Drip
private Drip ( ) : bool
Résultat bool
        private bool Drip()
        {
            if (tokensPerMS == 0)
            {
                content = maxBurst;
                return true;
            }
            else
            {
                int now = Environment.TickCount & Int32.MaxValue;
                int deltaMS = now - lastDrip;

                if (deltaMS <= 0)
                {
                    if (deltaMS < 0)
                        lastDrip = now;
                    return false;
                }

                int dripAmount = deltaMS * tokensPerMS;

                content = Math.Min(content + dripAmount, maxBurst);
                lastDrip = now;

                return true;
            }
        }