Search in sources :

Example 11 with PEPeerManager

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();
    }
}
Also used : PEPeer(com.biglybt.core.peer.PEPeer) PEPeerManager(com.biglybt.core.peer.PEPeerManager)

Example 12 with PEPeerManager

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);
}
Also used : PEPeerManager(com.biglybt.core.peer.PEPeerManager)

Example 13 with PEPeerManager

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);
}
Also used : PEPeerManager(com.biglybt.core.peer.PEPeerManager)

Example 14 with PEPeerManager

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);
}
Also used : PEPeerManager(com.biglybt.core.peer.PEPeerManager)

Example 15 with PEPeerManager

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);
}
Also used : PEPeerManager(com.biglybt.core.peer.PEPeerManager)

Aggregations

PEPeerManager (com.biglybt.core.peer.PEPeerManager)60 DownloadManager (com.biglybt.core.download.DownloadManager)29 PEPeer (com.biglybt.core.peer.PEPeer)18 DiskManager (com.biglybt.core.disk.DiskManager)13 DiskManagerFileInfo (com.biglybt.core.disk.DiskManagerFileInfo)9 DiskManagerPiece (com.biglybt.core.disk.DiskManagerPiece)8 PEPiece (com.biglybt.core.peer.PEPiece)8 PiecePicker (com.biglybt.core.peermanager.piecepicker.PiecePicker)7 List (java.util.List)7 LogEvent (com.biglybt.core.logging.LogEvent)6 Download (com.biglybt.pif.download.Download)6 File (java.io.File)6 ArrayList (java.util.ArrayList)6 DownloadManagerState (com.biglybt.core.download.DownloadManagerState)5 TOTorrent (com.biglybt.core.torrent.TOTorrent)5 URL (java.net.URL)5 Map (java.util.Map)5 GlobalManager (com.biglybt.core.global.GlobalManager)4 Tag (com.biglybt.core.tag.Tag)4 AERunnable (com.biglybt.core.util.AERunnable)4