org.gudy.azureus2.core3.tracker.server.impl
Class TRTrackerServerTorrentImpl

java.lang.Object
  extended by org.gudy.azureus2.core3.tracker.server.impl.TRTrackerServerTorrentImpl
All Implemented Interfaces:
TRTrackerServerTorrent

public class TRTrackerServerTorrentImpl
extends Object
implements TRTrackerServerTorrent


Nested Class Summary
protected static class TRTrackerServerTorrentImpl.lightweightSeed
           
protected static class TRTrackerServerTorrentImpl.QueuedPeer
           
 
Field Summary
static byte COMPACT_MODE_AZ
           
static byte COMPACT_MODE_AZ_2
           
static byte COMPACT_MODE_NONE
           
static byte COMPACT_MODE_NORMAL
           
static byte COMPACT_MODE_XML
           
static int MAX_DOWNLOAD_BYTES_PER_SEC
           
static int MAX_IP_OVERRIDE_PEERS
           
static int MAX_UPLOAD_BYTES_PER_SEC
           
static int MIN_CACHE_ENTRY_SIZE
           
protected  AEMonitor this_mon
           
static boolean USE_LIGHTWEIGHT_SEEDS
           
 
Constructor Summary
TRTrackerServerTorrentImpl(TRTrackerServerImpl _server, HashWrapper _hash, boolean _enabled)
           
 
Method Summary
 void addExplicitBiasedPeer(String ip, int port)
           
 TRTrackerServerTorrent addLink(String link)
           
 void addListener(TRTrackerServerTorrentListener l)
           
 void addPeerListener(TRTrackerServerTorrentPeerListener l)
           
protected  void checkForPeerListCompaction(boolean force)
           
protected  void checkTimeouts()
           
protected  void delete()
           
 void disableCaching()
           
 Map exportAnnounceToMap(String ip_address, HashMap preprocess_map, TRTrackerServerPeerImpl requesting_peer, boolean include_seeds, int num_want, long interval, long min_interval, boolean no_peer_id, byte compact_mode, byte crypto_level, DHTNetworkPosition network_position)
           
 Map exportScrapeToMap(String url_parameters, String ip_address, boolean allow_cache)
           
 int getBadNATPeerCount()
           
 HashWrapper getHash()
           
protected  int getLeecherCount()
           
protected  int getPeerCount()
           
 TRTrackerServerPeer[] getPeers()
           
protected  int getQueuedCount()
           
 TRTrackerServerPeerBase[] getQueuedPeers()
           
 URL[] getRedirects()
           
protected  int getSeedCount()
           
protected  int getSeedCountForScrape(boolean requester_is_biased)
           
 TRTrackerServerTorrentStats getStats()
           
 String getString()
           
protected  void handleRedirects(String url_parameters, String real_ip_address, boolean scrape)
           
 void importPeers(List peers)
           
 boolean isCachingEnabled()
           
 boolean isEnabled()
           
 TRTrackerServerPeerImpl peerContact(String url_parameters, String event, HashWrapper peer_id, int tcp_port, int udp_port, int http_port, byte crypto_level, byte az_ver, String original_address, String ip_address, boolean ip_override, boolean loopback, String tracker_key, long uploaded, long downloaded, long left, long interval_requested, int up_speed, DHTNetworkPosition network_position)
           
protected  void peerEvent(TRTrackerServerPeer peer, int event, String url_parameters)
           
 void peerQueued(String ip, int tcp_port, int udp_port, int http_port, byte crypto_level, byte az_ver, long timeout_secs, boolean seed)
           
 void remove(TRTrackerServerPeerBase peer)
           
 void removeLink(String link)
           
 void removeListener(TRTrackerServerTorrentListener l)
           
protected  void removePeer(TRTrackerServerPeerImpl peer, int peer_list_index, int reason, String url_parameters)
           
protected  void removePeer(TRTrackerServerPeerImpl peer, int reason, String url_parameters)
           
 void removePeerListener(TRTrackerServerTorrentPeerListener l)
           
 void setEnabled(boolean _enabled)
           
 void setMinBiasedPeers(int num)
           
 void setRedirects(URL[] urls)
           
protected  void updateBiasedPeers(Set biased_peers_set)
           
protected  void updateXferStats(int bytes_in, int bytes_out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_CACHE_ENTRY_SIZE

public static final int MIN_CACHE_ENTRY_SIZE
See Also:
Constant Field Values

MAX_UPLOAD_BYTES_PER_SEC

public static final int MAX_UPLOAD_BYTES_PER_SEC
See Also:
Constant Field Values

MAX_DOWNLOAD_BYTES_PER_SEC

public static final int MAX_DOWNLOAD_BYTES_PER_SEC
See Also:
Constant Field Values

USE_LIGHTWEIGHT_SEEDS

public static final boolean USE_LIGHTWEIGHT_SEEDS
See Also:
Constant Field Values

MAX_IP_OVERRIDE_PEERS

public static final int MAX_IP_OVERRIDE_PEERS
See Also:
Constant Field Values

COMPACT_MODE_NONE

public static final byte COMPACT_MODE_NONE
See Also:
Constant Field Values

COMPACT_MODE_NORMAL

public static final byte COMPACT_MODE_NORMAL
See Also:
Constant Field Values

COMPACT_MODE_AZ

public static final byte COMPACT_MODE_AZ
See Also:
Constant Field Values

COMPACT_MODE_AZ_2

public static final byte COMPACT_MODE_AZ_2
See Also:
Constant Field Values

COMPACT_MODE_XML

public static final byte COMPACT_MODE_XML
See Also:
Constant Field Values

this_mon

protected final AEMonitor this_mon
Constructor Detail

TRTrackerServerTorrentImpl

public TRTrackerServerTorrentImpl(TRTrackerServerImpl _server,
                                  HashWrapper _hash,
                                  boolean _enabled)
Method Detail

setEnabled

public void setEnabled(boolean _enabled)
Specified by:
setEnabled in interface TRTrackerServerTorrent

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface TRTrackerServerTorrent

setMinBiasedPeers

public void setMinBiasedPeers(int num)
Specified by:
setMinBiasedPeers in interface TRTrackerServerTorrent

importPeers

public void importPeers(List peers)
Specified by:
importPeers in interface TRTrackerServerTorrent

peerContact

public TRTrackerServerPeerImpl peerContact(String url_parameters,
                                           String event,
                                           HashWrapper peer_id,
                                           int tcp_port,
                                           int udp_port,
                                           int http_port,
                                           byte crypto_level,
                                           byte az_ver,
                                           String original_address,
                                           String ip_address,
                                           boolean ip_override,
                                           boolean loopback,
                                           String tracker_key,
                                           long uploaded,
                                           long downloaded,
                                           long left,
                                           long interval_requested,
                                           int up_speed,
                                           DHTNetworkPosition network_position)
                                    throws TRTrackerServerException
Throws:
TRTrackerServerException

peerQueued

public void peerQueued(String ip,
                       int tcp_port,
                       int udp_port,
                       int http_port,
                       byte crypto_level,
                       byte az_ver,
                       long timeout_secs,
                       boolean seed)

remove

public void remove(TRTrackerServerPeerBase peer)
Specified by:
remove in interface TRTrackerServerTorrent

removePeer

protected void removePeer(TRTrackerServerPeerImpl peer,
                          int reason,
                          String url_parameters)

removePeer

protected void removePeer(TRTrackerServerPeerImpl peer,
                          int peer_list_index,
                          int reason,
                          String url_parameters)

updateBiasedPeers

protected void updateBiasedPeers(Set biased_peers_set)

addLink

public TRTrackerServerTorrent addLink(String link)
Specified by:
addLink in interface TRTrackerServerTorrent

removeLink

public void removeLink(String link)
Specified by:
removeLink in interface TRTrackerServerTorrent

exportAnnounceToMap

public Map exportAnnounceToMap(String ip_address,
                               HashMap preprocess_map,
                               TRTrackerServerPeerImpl requesting_peer,
                               boolean include_seeds,
                               int num_want,
                               long interval,
                               long min_interval,
                               boolean no_peer_id,
                               byte compact_mode,
                               byte crypto_level,
                               DHTNetworkPosition network_position)

exportScrapeToMap

public Map exportScrapeToMap(String url_parameters,
                             String ip_address,
                             boolean allow_cache)
                      throws TRTrackerServerException
Throws:
TRTrackerServerException

checkTimeouts

protected void checkTimeouts()

checkForPeerListCompaction

protected void checkForPeerListCompaction(boolean force)

updateXferStats

protected void updateXferStats(int bytes_in,
                               int bytes_out)

getStats

public TRTrackerServerTorrentStats getStats()
Specified by:
getStats in interface TRTrackerServerTorrent

getPeerCount

protected int getPeerCount()

getSeedCount

protected int getSeedCount()

getSeedCountForScrape

protected int getSeedCountForScrape(boolean requester_is_biased)

getLeecherCount

protected int getLeecherCount()

getPeers

public TRTrackerServerPeer[] getPeers()
Specified by:
getPeers in interface TRTrackerServerTorrent

getQueuedCount

protected int getQueuedCount()

getQueuedPeers

public TRTrackerServerPeerBase[] getQueuedPeers()
Specified by:
getQueuedPeers in interface TRTrackerServerTorrent

getHash

public HashWrapper getHash()
Specified by:
getHash in interface TRTrackerServerTorrent

addExplicitBiasedPeer

public void addExplicitBiasedPeer(String ip,
                                  int port)
Specified by:
addExplicitBiasedPeer in interface TRTrackerServerTorrent

setRedirects

public void setRedirects(URL[] urls)
Specified by:
setRedirects in interface TRTrackerServerTorrent

getRedirects

public URL[] getRedirects()
Specified by:
getRedirects in interface TRTrackerServerTorrent

handleRedirects

protected void handleRedirects(String url_parameters,
                               String real_ip_address,
                               boolean scrape)
                        throws TRTrackerServerException
Throws:
TRTrackerServerException

addListener

public void addListener(TRTrackerServerTorrentListener l)
Specified by:
addListener in interface TRTrackerServerTorrent

removeListener

public void removeListener(TRTrackerServerTorrentListener l)
Specified by:
removeListener in interface TRTrackerServerTorrent

peerEvent

protected void peerEvent(TRTrackerServerPeer peer,
                         int event,
                         String url_parameters)
                  throws TRTrackerServerException
Throws:
TRTrackerServerException

addPeerListener

public void addPeerListener(TRTrackerServerTorrentPeerListener l)
Specified by:
addPeerListener in interface TRTrackerServerTorrent

removePeerListener

public void removePeerListener(TRTrackerServerTorrentPeerListener l)
Specified by:
removePeerListener in interface TRTrackerServerTorrent

disableCaching

public void disableCaching()
Specified by:
disableCaching in interface TRTrackerServerTorrent

isCachingEnabled

public boolean isCachingEnabled()

getBadNATPeerCount

public int getBadNATPeerCount()

delete

protected void delete()

getString

public String getString()
Specified by:
getString in interface TRTrackerServerTorrent