public interface BandwidthListenerMaintain three bandwidth estimators: Sent, received, and requested.
| Modifier and Type | Method and Description |
|---|---|
void | downloaded(int size)Called when bytes are unconditionally received. |
long | getDownBWLimit()Returns the current download bandwidth limit in bytes per second. |
long | getDownloadRate()Returns the average download rate in bytes per second. |
long | getUpBWLimit()Returns the current upload bandwidth limit in bytes per second. |
long | getUploadRate()Returns the average upload rate in bytes per second. |
boolean | overDownBWLimit()Checks if the current download bandwidth is over the limit. |
boolean | overUpBWLimit()Checks if the current upload bandwidth is over the limit. |
boolean | shouldRequest(Peer peer,
int size)Checks if we should request the given number of bytes from a peer. |
boolean | shouldSend(int size)Checks if we should send the given number of bytes. |
void | uploaded(int size)Called when bytes are unconditionally sent. |
void downloaded(int size)
size - the number of bytes receivedlong getDownBWLimit()
long getDownloadRate()
long getUpBWLimit()
long getUploadRate()
boolean overDownBWLimit()
boolean overUpBWLimit()
boolean shouldRequest(Peer peer, int size)
peer - the peersize - the number of bytes to requestboolean shouldSend(int size)
size - the number of bytes to sendvoid uploaded(int size)
size - the number of bytes sent