Package org.klomp.snark
Interface BandwidthListener
- All Known Implementing Classes:
BandwidthManager
,Peer
,PeerCoordinator
,WebPeer
public interface BandwidthListener
Bandwidth and bandwidth limits
Maintain three bandwidth estimators:
Sent, received, and requested.
- Since:
- 0.9.62
-
Method Summary
Modifier and TypeMethodDescriptionvoid
downloaded
(int size) We unconditionally received this many byteslong
Current limit in BPSlong
The average rate in Bpslong
Current limit in BPSlong
The average rate in Bpsboolean
Are we currently over the limit?boolean
Are we currently over the limit?boolean
shouldRequest
(Peer peer, int size) Should we request this many bytes?boolean
shouldSend
(int size) Should we send this many bytes? Do NOT call uploaded() if this returns true.void
uploaded
(int size) We unconditionally sent this many bytes
-
Method Details
-
getUploadRate
long getUploadRate()The average rate in Bps -
getDownloadRate
long getDownloadRate()The average rate in Bps -
uploaded
void uploaded(int size) We unconditionally sent this many bytes -
downloaded
void downloaded(int size) We unconditionally received this many bytes -
shouldSend
boolean shouldSend(int size) Should we send this many bytes? Do NOT call uploaded() if this returns true. -
shouldRequest
Should we request this many bytes? -
getUpBWLimit
long getUpBWLimit()Current limit in BPS -
getDownBWLimit
long getDownBWLimit()Current limit in BPS -
overUpBWLimit
boolean overUpBWLimit()Are we currently over the limit? -
overDownBWLimit
boolean overDownBWLimit()Are we currently over the limit?
-