Methods Summary |
---|
public void | addRateLimiter(LimitedRateGroup limiter, boolean upload)
synchronized( this ){
if ( upload ){
for (int i=0;i<upload_limiters.length;i++){
if ( upload_limiters[i] == limiter ){
return;
}
}
LimitedRateGroup[] new_upload_limiters = new LimitedRateGroup[upload_limiters.length+1];
System.arraycopy(upload_limiters, 0, new_upload_limiters, 0, upload_limiters.length );
new_upload_limiters[ upload_limiters.length ] = limiter;
upload_limiters = new_upload_limiters;
}else{
for (int i=0;i<download_limiters.length;i++){
if ( download_limiters[i] == limiter ){
return;
}
}
LimitedRateGroup[] new_download_limiters = new LimitedRateGroup[download_limiters.length+1];
System.arraycopy(download_limiters, 0, new_download_limiters, 0, download_limiters.length );
new_download_limiters[ download_limiters.length ] = limiter;
download_limiters = new_download_limiters;
}
}
NetworkManager.getSingleton().addRateLimiter( this, limiter, upload );
|
public int | getDownloadLimit()
return( download_limit );
|
public LimitedRateGroup[] | getRateLimiters(boolean upload)
if ( upload ){
return( upload_limiters );
}else{
return( download_limiters );
}
|
public int | getUploadLimit()
return( upload_limit );
|
public void | removeRateLimiter(LimitedRateGroup limiter, boolean upload)
synchronized( this ){
if ( upload ){
if ( upload_limiters.length == 0 ){
return;
}
int pos = 0;
LimitedRateGroup[] new_upload_limiters = new LimitedRateGroup[upload_limiters.length-1];
for (int i=0;i<upload_limiters.length;i++){
if ( upload_limiters[i] != limiter ){
if ( pos == new_upload_limiters.length ){
return;
}
new_upload_limiters[pos++] = upload_limiters[i];
}
}
upload_limiters = new_upload_limiters;
}else{
if ( download_limiters.length == 0 ){
return;
}
int pos = 0;
LimitedRateGroup[] new_download_limiters = new LimitedRateGroup[download_limiters.length-1];
for (int i=0;i<download_limiters.length;i++){
if ( download_limiters[i] != limiter ){
if ( pos == new_download_limiters.length ){
return;
}
new_download_limiters[pos++] = download_limiters[i];
}
}
download_limiters = new_download_limiters;
}
}
NetworkManager.getSingleton().removeRateLimiter( this, limiter, upload );
|
public void | setDownloadLimit(int limit)
download_limit = limit;
|
public void | setUploadLimit(int limit)
upload_limit = limit;
|