Class TRHostImpl
java.lang.Object
com.biglybt.core.tracker.host.impl.TRHostImpl
- All Implemented Interfaces:
TRTrackerAnnouncerFactoryListener, TRHost, TRTrackerServerAuthenticationListener, TRTrackerServerFactoryListener, TRTrackerServerListener, TRTrackerServerListener2, TRTrackerServerRequestListener
public class TRHostImpl
extends Object
implements TRHost, TRTrackerAnnouncerFactoryListener, TRTrackerServerListener2, TRTrackerServerListener, TRTrackerServerFactoryListener, TRTrackerServerRequestListener, TRTrackerServerAuthenticationListener
-
Nested Class Summary
Nested classes/interfaces inherited from interface TRTrackerServerListener2
TRTrackerServerListener2.ExternalRequest -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<TRHostAuthenticationListener> private static final AEMonitorprivate booleanprivate TRHostConfigImpl(package private) final AsyncDispatcherprivate static booleanprivate final Map<HashWrapper, TRHostTorrent> private final Map<TOTorrent, TRHostTorrent> private final List<TRHostTorrent> private static final intprivate static final intprivate static final intprivate final ListenerManager<TRHostListener> private final CopyOnWriteList<TRHostListener2> private static final LogIDsprivate booleanprivate final Hashtable<String, TRTrackerServer> private static TRHostImplstatic final intprotected final AEMonitorprivate static final intprivate static final intprivate static final intprivate static final intprivate final Map<TOTorrent, TRTrackerAnnouncer> private static final intprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected voidaddExternalTorrent(byte[] hash, int state, long date_added) voidAdd and fire listener for each torrent already hostedvoidprotected TRHostTorrentaddTorrent(TOTorrent torrent, int state, boolean persistent, boolean passive, long date_added) protected voidaddTrackerAnnounce(TOTorrent torrent) booleanauthenticate(String headers, URL resource, String user, String password) checks the password against user and returns true if OKbyte[]authenticate(URL resource, String user) returns SHA1 hash of pw for user if availablevoidclientCreated(TRTrackerAnnouncer client) voidclientDestroyed(TRTrackerAnnouncer client) voidclose()static TRHostcreate()booleandenied(byte[] hash, boolean permitted) getHostTorrent(TOTorrent torrent) returns the host torrent for the torrent if it exists, null otherwisegetName()intprotected TRTrackerAnnouncergetTrackerClient(TRHostTorrent host_torrent) booleanbooleanhandleExternalRequest(InetSocketAddress client_address, String user, String url, URL absolute_url, String header, InputStream is, OutputStream os, AsyncController async) hostTorrent(TOTorrent torrent, boolean persistent, boolean passive) protected voidhostTorrentStateChange(TRHostTorrent host_torrent) voidinitialise(TRHostTorrentFinder finder) protected TRHostTorrentlookupHostTorrent(TOTorrent torrent) protected TRHostTorrentlookupHostTorrentViaHash(byte[] hash) booleanvoidpostProcess(TRTrackerServerRequest request) voidpreProcess(TRTrackerServerRequest request) publishTorrent(TOTorrent torrent) protected voidremove(TRHostTorrent host_torrent) voidvoidvoidvoidserverCreated(TRTrackerServer server) voidserverDestroyed(TRTrackerServer server) protected voidstartHosting(TRTrackerAnnouncer tracker_client) protected voidstartHosting(TRHostTorrentHostImpl host_torrent) protected voidstartHosting(TRHostTorrentHostImpl host_torrent, TRTrackerAnnouncer tracker_client) protected TRTrackerServerstartServer(int protocol, int port, boolean ssl) protected voidstartTorrent(TRHostTorrentHostImpl torrent) protected voidstopHosting(TRTrackerAnnouncer tracker_client) protected voidstopHosting(TRHostTorrentHostImpl host_torrent) protected voidstopHosting(TRHostTorrentHostImpl host_torrent, TRTrackerAnnouncer tracker_client) protected voidstopTorrent(TRHostTorrentHostImpl torrent) protected voidprotected void
-
Field Details
-
LOGID
-
URL_DEFAULT_PORT
private static final int URL_DEFAULT_PORT- See Also:
-
URL_DEFAULT_PORT_SSL
private static final int URL_DEFAULT_PORT_SSL- See Also:
-
STATS_PERIOD_SECS
public static final int STATS_PERIOD_SECS- See Also:
-
TICK_PERIOD_SECS
private static final int TICK_PERIOD_SECS- See Also:
-
TIDY_START_SECS
private static final int TIDY_START_SECS- See Also:
-
TICKS_PER_STATS_PERIOD
private static final int TICKS_PER_STATS_PERIOD- See Also:
-
TICKS_BEFORE_TIDY
private static final int TICKS_BEFORE_TIDY- See Also:
-
singleton
-
class_mon
-
config
-
server_map
-
host_torrents
-
host_torrent_hash_map
-
host_torrent_map
-
tracker_client_map
-
LDT_TORRENT_ADDED
private static final int LDT_TORRENT_ADDED- See Also:
-
LDT_TORRENT_REMOVED
private static final int LDT_TORRENT_REMOVED- See Also:
-
LDT_TORRENT_CHANGED
private static final int LDT_TORRENT_CHANGED- See Also:
-
listeners
-
listeners2
-
host_add_announce_urls
private static boolean host_add_announce_urls -
auth_listeners
-
server_factory_listener_added
private boolean server_factory_listener_added -
this_mon
-
closed
private volatile boolean closed -
dispatcher
-
-
Constructor Details
-
TRHostImpl
protected TRHostImpl()
-
-
Method Details
-
create
-
initialise
- Specified by:
initialisein interfaceTRHost
-
getName
-
hostTorrent
public TRHostTorrent hostTorrent(TOTorrent torrent, boolean persistent, boolean passive) throws TRHostException - Specified by:
hostTorrentin interfaceTRHost- Throws:
TRHostException
-
publishTorrent
- Specified by:
publishTorrentin interfaceTRHost- Throws:
TRHostException
-
addTorrent
protected TRHostTorrent addTorrent(TOTorrent torrent, int state, boolean persistent, boolean passive, long date_added) throws TRHostException - Throws:
TRHostException
-
torrentUpdated
-
getBindIP
-
startServer
- Throws:
TRHostException
-
lookupHostTorrent
-
startHosting
-
startHosting
-
startHosting
-
remove
-
stopHosting
-
stopHosting
-
stopHosting
-
getTrackerClient
-
hostTorrentStateChange
-
getTorrents
- Specified by:
getTorrentsin interfaceTRHost
-
getTorrentCount
public int getTorrentCount()- Specified by:
getTorrentCountin interfaceTRHost
-
clientCreated
- Specified by:
clientCreatedin interfaceTRTrackerAnnouncerFactoryListener
-
clientDestroyed
- Specified by:
clientDestroyedin interfaceTRTrackerAnnouncerFactoryListener
-
lookupHostTorrentViaHash
-
permitted
- Specified by:
permittedin interfaceTRTrackerServerListener
-
addExternalTorrent
protected void addExternalTorrent(byte[] hash, int state, long date_added) -
denied
public boolean denied(byte[] hash, boolean permitted) - Specified by:
deniedin interfaceTRTrackerServerListener
-
handleExternalRequest
public boolean handleExternalRequest(InetSocketAddress client_address, String user, String url, URL absolute_url, String header, InputStream is, OutputStream os, AsyncController async) throws IOException - Specified by:
handleExternalRequestin interfaceTRTrackerServerListener- Throws:
IOException
-
handleExternalRequest
public boolean handleExternalRequest(TRTrackerServerListener2.ExternalRequest request) throws IOException - Specified by:
handleExternalRequestin interfaceTRTrackerServerListener2- Throws:
IOException
-
getHostTorrent
Description copied from interface:TRHostreturns the host torrent for the torrent if it exists, null otherwise- Specified by:
getHostTorrentin interfaceTRHost- Parameters:
torrent-- Returns:
-
addListener
Add and fire listener for each torrent already hosted- Specified by:
addListenerin interfaceTRHost
-
removeListener
- Specified by:
removeListenerin interfaceTRHost
-
addListener2
- Specified by:
addListener2in interfaceTRHost
-
removeListener2
- Specified by:
removeListener2in interfaceTRHost
-
torrentListenerRegistered
protected void torrentListenerRegistered() -
serverCreated
- Specified by:
serverCreatedin interfaceTRTrackerServerFactoryListener
-
serverDestroyed
- Specified by:
serverDestroyedin interfaceTRTrackerServerFactoryListener
-
preProcess
- Specified by:
preProcessin interfaceTRTrackerServerRequestListener- Throws:
TRTrackerServerException
-
postProcess
- Specified by:
postProcessin interfaceTRTrackerServerRequestListener- Throws:
TRTrackerServerException
-
close
-
authenticate
Description copied from interface:TRTrackerServerAuthenticationListenerchecks the password against user and returns true if OK- Specified by:
authenticatein interfaceTRTrackerServerAuthenticationListener- Parameters:
resource-user-password-- Returns:
-
authenticate
Description copied from interface:TRTrackerServerAuthenticationListenerreturns SHA1 hash of pw for user if available- Specified by:
authenticatein interfaceTRTrackerServerAuthenticationListener- Parameters:
resource-user-- Returns:
-
addAuthenticationListener
- Specified by:
addAuthenticationListenerin interfaceTRHost
-
removeAuthenticationListener
- Specified by:
removeAuthenticationListenerin interfaceTRHost
-
startTorrent
-
stopTorrent
-
addTrackerAnnounce
-