use of com.biglybt.core.peer.PEPeerManager in project BiglyBT by BiglySoftware.
the class DownloadManagerImpl method addPeerListener.
@Override
public void addPeerListener(DownloadManagerPeerListener listener, boolean bDispatchForExisting) {
try {
peer_listeners_mon.enter();
peer_listeners.addListener(listener);
if (!bDispatchForExisting) {
// finally will call
return;
}
for (PEPeer peer : current_peers.keySet()) {
peer_listeners.dispatch(listener, LDT_PE_PEER_ADDED, peer);
}
PEPeerManager temp = controller.getPeerManager();
if (temp != null) {
peer_listeners.dispatch(listener, LDT_PE_PM_ADDED, temp);
}
} finally {
peer_listeners_mon.exit();
}
}
use of com.biglybt.core.peer.PEPeerManager in project BiglyBT by BiglySoftware.
the class GlobalManagerImpl method stateChanged.
// DownloadManagerListener
@Override
public void stateChanged(DownloadManager manager, int new_state) {
if (needsSavingCozStateChanged == 0) {
// make sure we update 'downloads.config' on state changes
needsSavingCozStateChanged = SystemTime.getMonotonousTime();
}
// run seeding-only-mode check
PEPeerManager pm_manager = manager.getPeerManager();
if (new_state == DownloadManager.STATE_DOWNLOADING && pm_manager != null && pm_manager.hasDownloadablePiece()) {
// the new state is downloading, so can skip the full check
setSeedingOnlyState(false, false);
} else {
checkSeedingOnlyState();
}
checkForceStart(manager.isForceStart() && new_state == DownloadManager.STATE_DOWNLOADING);
}
use of com.biglybt.core.peer.PEPeerManager in project BiglyBT by BiglySoftware.
the class DownloadManagerStatsImpl method getTimeSinceLastDataSentInSeconds.
@Override
public int getTimeSinceLastDataSentInSeconds() {
PEPeerManager pm = download_manager.getPeerManager();
int res = saved_SecondsSinceUpload;
if (pm != null) {
int current = pm.getStats().getTimeSinceLastDataSentInSeconds();
if (current >= 0) {
// activity this session, use this value
res = current;
} else {
if (res >= 0) {
long now = SystemTime.getCurrentTime();
long elapsed = now - pm.getTimeStarted(false);
if (elapsed < 0) {
elapsed = 0;
}
res += elapsed / 1000;
}
}
}
return (res);
}
use of com.biglybt.core.peer.PEPeerManager in project BiglyBT by BiglySoftware.
the class DownloadManagerStatsImpl method getPeakDataSendRate.
@Override
public long getPeakDataSendRate() {
PEPeerManager pm = download_manager.getPeerManager();
long result = saved_peak_send_rate;
if (pm != null) {
result = Math.max(result, pm.getStats().getPeakDataSendRate());
}
return (result);
}
use of com.biglybt.core.peer.PEPeerManager in project BiglyBT by BiglySoftware.
the class DownloadManagerStatsImpl method getPeakDataReceiveRate.
@Override
public long getPeakDataReceiveRate() {
PEPeerManager pm = download_manager.getPeerManager();
long result = saved_peak_receive_rate;
if (pm != null) {
result = Math.max(result, pm.getStats().getPeakDataReceiveRate());
}
return (result);
}
Aggregations