C# Class Universe.ClientStack.TokenBucket

A hierarchical token bucket for bandwidth throttling. See http://en.wikipedia.org/wiki/Token_bucket for more information
Afficher le fichier Open project: Virtual-Universe/Virtual-Universe Class Usage Examples

Méthodes publiques

Méthode Description
Drip ( ) : bool

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

RemoveTokens ( int amount ) : bool

Remove a given number of tokens from the bucket

RemoveTokens ( int amount, bool &dripSucceeded ) : bool

Remove a given number of tokens from the bucket

TokenBucket ( TokenBucket parent, int maxBurst, int dripRate ) : System

Default constructor

Method Details

Drip() public 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
public Drip ( ) : bool
Résultat bool

RemoveTokens() public méthode

Remove a given number of tokens from the bucket
public RemoveTokens ( int amount ) : bool
amount int Number of tokens to remove from the bucket
Résultat bool

RemoveTokens() public méthode

Remove a given number of tokens from the bucket
public RemoveTokens ( int amount, bool &dripSucceeded ) : bool
amount int Number of tokens to remove from the bucket
dripSucceeded bool /// True if tokens were added to the bucket /// during this call, otherwise false ///
Résultat bool

TokenBucket() public méthode

Default constructor
public TokenBucket ( TokenBucket parent, int maxBurst, int dripRate ) : System
parent TokenBucket /// Parent bucket if this is a child bucket, or /// null if this is a root bucket ///
maxBurst int /// Maximum size of the bucket in bytes, or /// zero if this bucket has no maximum capacity ///
dripRate int /// Rate that the bucket fills, in bytes per /// second. If zero, the bucket always remains full ///
Résultat System