org.gudy.azureus2.pluginsimpl.local.peers
Class PeerManagerImpl

java.lang.Object
  extended by org.gudy.azureus2.pluginsimpl.local.peers.PeerManagerImpl
All Implemented Interfaces:
PeerManager

public class PeerManagerImpl
extends java.lang.Object
implements PeerManager


Nested Class Summary
protected  class PeerManagerImpl.pieceFacade
           
 
Field Summary
protected  PEPeerManager manager
           
protected static AEMonitor pm_map_mon
           
protected  AEMonitor this_mon
           
 
Constructor Summary
protected PeerManagerImpl(PEPeerManager _manager)
           
 
Method Summary
 void addListener(PeerManagerListener l)
           
 void addListener(PeerManagerListener2 l)
           
 void addPeer(Peer peer)
           
 void addPeer(java.lang.String ip_address, int tcp_port)
          Add a new peer, using the default internal Peer implementation (like for peers given in announce reply), using the given address and port.
 void addPeer(java.lang.String ip_address, int tcp_port, boolean use_crypto)
           
 void addPeer(java.lang.String ip_address, int tcp_port, int udp_port, boolean use_crypto)
           
 void addPeer(java.lang.String ip_address, int tcp_port, int udp_port, boolean use_crypto, java.util.Map user_data)
           
protected  void checkIfPrivate()
           
 PeerStats createPeerStats(Peer peer)
           
 PEPeerManager getDelegate()
           
 DiskManager getDiskManager()
           
 Download getDownload()
           
 int getDownloadRateLimitBytesPerSecond()
           
protected  int getPartitionID()
           
static PeerImpl getPeerForPEPeer(PEPeer pe_peer)
           
static PeerManagerImpl getPeerManager(PEPeerManager _manager)
           
 Peer[] getPeers()
           
 Peer[] getPeers(java.lang.String address)
          returns the peers for the given address
 PeerDescriptor[] getPendingPeers()
          Get the list of currently pending peers
 PeerDescriptor[] getPendingPeers(java.lang.String address)
          returns the pending connections to the given address
 Piece[] getPieces()
           
 PeerManagerStats getStats()
           
 long getTimeSinceConnectionEstablished(Peer peer)
           
 int getUploadRateLimitBytesPerSecond()
           
 boolean isSeeding()
           
 boolean isSuperSeeding()
           
protected  PeerForeignDelegate lookupForeignPeer(Peer _foreign)
           
 PEPeer mapForeignPeer(Peer _foreign)
           
 java.util.List mapForeignPeers(Peer[] _foreigns)
           
 void peerDiscovered(java.lang.String peer_source, java.lang.String ip_address, int tcp_port, int udp_port, boolean use_crypto)
           
protected  boolean pluginPeerSourceEnabled()
           
 void removeListener(PeerManagerListener l)
           
 void removeListener(PeerManagerListener2 l)
           
 void removePeer(Peer peer)
           
protected  void removePeer(Peer peer, java.lang.String reason)
           
 void requestCancelled(PeerReadRequest request, Peer sender)
           
 void requestComplete(PeerReadRequest request, PooledByteBuffer data, Peer sender)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

manager

protected PEPeerManager manager

pm_map_mon

protected static AEMonitor pm_map_mon

this_mon

protected AEMonitor this_mon
Constructor Detail

PeerManagerImpl

protected PeerManagerImpl(PEPeerManager _manager)
Method Detail

getPeerManager

public static PeerManagerImpl getPeerManager(PEPeerManager _manager)

getDelegate

public PEPeerManager getDelegate()

getDiskManager

public DiskManager getDiskManager()
Specified by:
getDiskManager in interface PeerManager

getStats

public PeerManagerStats getStats()
Specified by:
getStats in interface PeerManager

isSeeding

public boolean isSeeding()
Specified by:
isSeeding in interface PeerManager

isSuperSeeding

public boolean isSuperSeeding()
Specified by:
isSuperSeeding in interface PeerManager

getDownload

public Download getDownload()
                     throws DownloadException
Specified by:
getDownload in interface PeerManager
Throws:
DownloadException

getPieces

public Piece[] getPieces()
Specified by:
getPieces in interface PeerManager

createPeerStats

public PeerStats createPeerStats(Peer peer)
Specified by:
createPeerStats in interface PeerManager

requestComplete

public void requestComplete(PeerReadRequest request,
                            PooledByteBuffer data,
                            Peer sender)
Specified by:
requestComplete in interface PeerManager

requestCancelled

public void requestCancelled(PeerReadRequest request,
                             Peer sender)
Specified by:
requestCancelled in interface PeerManager

getPartitionID

protected int getPartitionID()

addPeer

public void addPeer(Peer peer)
Specified by:
addPeer in interface PeerManager

removePeer

public void removePeer(Peer peer)
Specified by:
removePeer in interface PeerManager

removePeer

protected void removePeer(Peer peer,
                          java.lang.String reason)

addPeer

public void addPeer(java.lang.String ip_address,
                    int tcp_port)
Description copied from interface: PeerManager
Add a new peer, using the default internal Peer implementation (like for peers given in announce reply), using the given address and port.

Specified by:
addPeer in interface PeerManager
Parameters:
ip_address - of peer to inject
tcp_port - of peer to inject

addPeer

public void addPeer(java.lang.String ip_address,
                    int tcp_port,
                    boolean use_crypto)
Specified by:
addPeer in interface PeerManager

addPeer

public void addPeer(java.lang.String ip_address,
                    int tcp_port,
                    int udp_port,
                    boolean use_crypto)
Specified by:
addPeer in interface PeerManager

addPeer

public void addPeer(java.lang.String ip_address,
                    int tcp_port,
                    int udp_port,
                    boolean use_crypto,
                    java.util.Map user_data)
Specified by:
addPeer in interface PeerManager

peerDiscovered

public void peerDiscovered(java.lang.String peer_source,
                           java.lang.String ip_address,
                           int tcp_port,
                           int udp_port,
                           boolean use_crypto)
Specified by:
peerDiscovered in interface PeerManager

pluginPeerSourceEnabled

protected boolean pluginPeerSourceEnabled()

checkIfPrivate

protected void checkIfPrivate()

getPeers

public Peer[] getPeers()
Specified by:
getPeers in interface PeerManager

getPeers

public Peer[] getPeers(java.lang.String address)
Description copied from interface: PeerManager
returns the peers for the given address

Specified by:
getPeers in interface PeerManager
Returns:

getPendingPeers

public PeerDescriptor[] getPendingPeers()
Description copied from interface: PeerManager
Get the list of currently pending peers

Specified by:
getPendingPeers in interface PeerManager
Returns:

getPendingPeers

public PeerDescriptor[] getPendingPeers(java.lang.String address)
Description copied from interface: PeerManager
returns the pending connections to the given address

Specified by:
getPendingPeers in interface PeerManager
Returns:

getTimeSinceConnectionEstablished

public long getTimeSinceConnectionEstablished(Peer peer)

mapForeignPeer

public PEPeer mapForeignPeer(Peer _foreign)

lookupForeignPeer

protected PeerForeignDelegate lookupForeignPeer(Peer _foreign)

mapForeignPeers

public java.util.List mapForeignPeers(Peer[] _foreigns)

getPeerForPEPeer

public static PeerImpl getPeerForPEPeer(PEPeer pe_peer)

getUploadRateLimitBytesPerSecond

public int getUploadRateLimitBytesPerSecond()
Specified by:
getUploadRateLimitBytesPerSecond in interface PeerManager

getDownloadRateLimitBytesPerSecond

public int getDownloadRateLimitBytesPerSecond()
Specified by:
getDownloadRateLimitBytesPerSecond in interface PeerManager

addListener

public void addListener(PeerManagerListener l)
Specified by:
addListener in interface PeerManager

removeListener

public void removeListener(PeerManagerListener l)
Specified by:
removeListener in interface PeerManager

addListener

public void addListener(PeerManagerListener2 l)
Specified by:
addListener in interface PeerManager

removeListener

public void removeListener(PeerManagerListener2 l)
Specified by:
removeListener in interface PeerManager