use of com.biglybt.pifimpl.local.utils.UtilitiesImpl.PluginLimitedRateGroup in project BiglyBT by BiglySoftware.
the class PeerImpl method closed.
protected void closed() {
synchronized (this) {
closed = true;
if (up_rg_listener != null) {
// tidy up
LimitedRateGroup[] limiters = delegate.getRateLimiters(true);
for (LimitedRateGroup l : limiters) {
if (l instanceof PluginLimitedRateGroup) {
((PluginLimitedRateGroup) l).removeListener(up_rg_listener);
}
delegate.removeRateLimiter(l, true);
}
limiters = delegate.getRateLimiters(false);
for (LimitedRateGroup l : limiters) {
if (l instanceof PluginLimitedRateGroup) {
((PluginLimitedRateGroup) l).removeListener(down_rg_listener);
}
delegate.removeRateLimiter(l, false);
}
}
}
if (delegate instanceof PeerForeignDelegate) {
((PeerForeignDelegate) delegate).stop();
}
}
use of com.biglybt.pifimpl.local.utils.UtilitiesImpl.PluginLimitedRateGroup in project BiglyBT by BiglySoftware.
the class PeerImpl method removeRateLimiter.
@Override
public void removeRateLimiter(RateLimiter limiter, boolean is_upload) {
synchronized (this) {
PluginLimitedRateGroup wrapped_limiter = UtilitiesImpl.wrapLimiter(limiter, true);
if (up_rg_listener != null) {
if (is_upload) {
wrapped_limiter.removeListener(up_rg_listener);
} else {
wrapped_limiter.removeListener(down_rg_listener);
}
}
delegate.removeRateLimiter(wrapped_limiter, is_upload);
}
}
use of com.biglybt.pifimpl.local.utils.UtilitiesImpl.PluginLimitedRateGroup in project BiglyBT by BiglySoftware.
the class PeerImpl method getRateLimiters.
@Override
public RateLimiter[] getRateLimiters(boolean is_upload) {
LimitedRateGroup[] limiters = delegate.getRateLimiters(is_upload);
RateLimiter[] result = new RateLimiter[limiters.length];
int pos = 0;
for (LimitedRateGroup l : limiters) {
if (l instanceof PluginLimitedRateGroup) {
result[pos++] = UtilitiesImpl.unwrapLmiter((PluginLimitedRateGroup) l);
}
}
if (pos == result.length) {
return (result);
}
RateLimiter[] result_mod = new RateLimiter[pos];
System.arraycopy(result, 0, result_mod, 0, pos);
return (result_mod);
}
use of com.biglybt.pifimpl.local.utils.UtilitiesImpl.PluginLimitedRateGroup in project BiglyBT by BiglySoftware.
the class PeerImpl method addRateLimiter.
@Override
public void addRateLimiter(RateLimiter limiter, boolean is_upload) {
synchronized (this) {
if (closed) {
return;
}
PluginLimitedRateGroup wrapped_limiter = UtilitiesImpl.wrapLimiter(limiter, true);
if (up_rg_listener == null) {
createRGListeners();
}
if (is_upload) {
wrapped_limiter.addListener(up_rg_listener);
} else {
wrapped_limiter.addListener(down_rg_listener);
}
delegate.addRateLimiter(wrapped_limiter, is_upload);
}
}
Aggregations