org.gudy.azureus2.core3.tracker.host.impl
Class TRHostImpl
java.lang.Object
org.gudy.azureus2.core3.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
Method Summary |
void |
addAuthenticationListener(TRHostAuthenticationListener l)
|
protected void |
addExternalTorrent(byte[] hash,
int state,
long date_added)
|
void |
addListener(TRHostListener l)
Add and fire listener for each torrent already hosted |
void |
addListener2(TRHostListener2 l)
|
protected TRHostTorrent |
addTorrent(TOTorrent torrent,
int state,
boolean persistent,
boolean passive,
long date_added)
|
protected void |
addTrackerAnnounce(TOTorrent torrent)
|
boolean |
authenticate(String headers,
URL resource,
String user,
String password)
checks the password against user and returns true if OK |
byte[] |
authenticate(URL resource,
String user)
returns SHA1 hash of pw for user if available |
void |
clientCreated(TRTrackerAnnouncer client)
|
void |
clientDestroyed(TRTrackerAnnouncer client)
|
void |
close()
|
static TRHost |
create()
|
boolean |
denied(byte[] hash,
boolean permitted)
|
InetAddress |
getBindIP()
|
TRHostTorrent |
getHostTorrent(TOTorrent torrent)
returns the host torrent for the torrent if it exists, null otherwise |
String |
getName()
|
TRHostTorrent[] |
getTorrents()
|
protected TRTrackerAnnouncer |
getTrackerClient(TRHostTorrent host_torrent)
|
boolean |
handleExternalRequest(InetSocketAddress client_address,
String user,
String url,
URL absolute_url,
String header,
InputStream is,
OutputStream os,
AsyncController async)
|
boolean |
handleExternalRequest(TRTrackerServerListener2.ExternalRequest request)
|
TRHostTorrent |
hostTorrent(TOTorrent torrent,
boolean persistent,
boolean passive)
|
protected void |
hostTorrentStateChange(TRHostTorrent host_torrent)
|
void |
initialise(TRHostTorrentFinder finder)
|
protected TRHostTorrent |
lookupHostTorrent(TOTorrent torrent)
|
protected TRHostTorrent |
lookupHostTorrentViaHash(byte[] hash)
|
boolean |
permitted(String originator,
byte[] hash,
boolean explicit)
|
void |
postProcess(TRTrackerServerRequest request)
|
void |
preProcess(TRTrackerServerRequest request)
|
TRHostTorrent |
publishTorrent(TOTorrent torrent)
|
protected void |
remove(TRHostTorrent host_torrent)
|
void |
removeAuthenticationListener(TRHostAuthenticationListener l)
|
void |
removeListener(TRHostListener l)
|
void |
removeListener2(TRHostListener2 l)
|
void |
serverCreated(TRTrackerServer server)
|
void |
serverDestroyed(TRTrackerServer server)
|
protected void |
startHosting(TRHostTorrentHostImpl host_torrent)
|
protected void |
startHosting(TRHostTorrentHostImpl host_torrent,
TRTrackerAnnouncer tracker_client)
|
protected void |
startHosting(TRTrackerAnnouncer tracker_client)
|
protected TRTrackerServer |
startServer(int protocol,
int port,
boolean ssl)
|
protected void |
startTorrent(TRHostTorrentHostImpl torrent)
|
protected void |
stopHosting(TRHostTorrentHostImpl host_torrent)
|
protected void |
stopHosting(TRHostTorrentHostImpl host_torrent,
TRTrackerAnnouncer tracker_client)
|
protected void |
stopHosting(TRTrackerAnnouncer tracker_client)
|
protected void |
stopTorrent(TRHostTorrentHostImpl torrent)
|
protected void |
torrentListenerRegistered()
|
protected void |
torrentUpdated(TRHostTorrentHostImpl hti)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
STATS_PERIOD_SECS
public static final int STATS_PERIOD_SECS
- See Also:
- Constant Field Values
this_mon
protected final AEMonitor this_mon
TRHostImpl
protected TRHostImpl()
create
public static TRHost create()
initialise
public void initialise(TRHostTorrentFinder finder)
- Specified by:
initialise
in interface TRHost
getName
public String getName()
- Specified by:
getName
in interface TRHost
hostTorrent
public TRHostTorrent hostTorrent(TOTorrent torrent,
boolean persistent,
boolean passive)
throws TRHostException
- Specified by:
hostTorrent
in interface TRHost
- Throws:
TRHostException
publishTorrent
public TRHostTorrent publishTorrent(TOTorrent torrent)
throws TRHostException
- Specified by:
publishTorrent
in interface TRHost
- Throws:
TRHostException
addTorrent
protected TRHostTorrent addTorrent(TOTorrent torrent,
int state,
boolean persistent,
boolean passive,
long date_added)
throws TRHostException
- Throws:
TRHostException
torrentUpdated
protected void torrentUpdated(TRHostTorrentHostImpl hti)
getBindIP
public InetAddress getBindIP()
- Specified by:
getBindIP
in interface TRHost
startServer
protected TRTrackerServer startServer(int protocol,
int port,
boolean ssl)
throws TRHostException
- Throws:
TRHostException
lookupHostTorrent
protected TRHostTorrent lookupHostTorrent(TOTorrent torrent)
startHosting
protected void startHosting(TRHostTorrentHostImpl host_torrent)
startHosting
protected void startHosting(TRTrackerAnnouncer tracker_client)
startHosting
protected void startHosting(TRHostTorrentHostImpl host_torrent,
TRTrackerAnnouncer tracker_client)
remove
protected void remove(TRHostTorrent host_torrent)
stopHosting
protected void stopHosting(TRHostTorrentHostImpl host_torrent)
stopHosting
protected void stopHosting(TRTrackerAnnouncer tracker_client)
stopHosting
protected void stopHosting(TRHostTorrentHostImpl host_torrent,
TRTrackerAnnouncer tracker_client)
getTrackerClient
protected TRTrackerAnnouncer getTrackerClient(TRHostTorrent host_torrent)
hostTorrentStateChange
protected void hostTorrentStateChange(TRHostTorrent host_torrent)
getTorrents
public TRHostTorrent[] getTorrents()
- Specified by:
getTorrents
in interface TRHost
clientCreated
public void clientCreated(TRTrackerAnnouncer client)
- Specified by:
clientCreated
in interface TRTrackerAnnouncerFactoryListener
clientDestroyed
public void clientDestroyed(TRTrackerAnnouncer client)
- Specified by:
clientDestroyed
in interface TRTrackerAnnouncerFactoryListener
lookupHostTorrentViaHash
protected TRHostTorrent lookupHostTorrentViaHash(byte[] hash)
permitted
public boolean permitted(String originator,
byte[] hash,
boolean explicit)
- Specified by:
permitted
in interface TRTrackerServerListener
addExternalTorrent
protected void addExternalTorrent(byte[] hash,
int state,
long date_added)
denied
public boolean denied(byte[] hash,
boolean permitted)
- Specified by:
denied
in interface TRTrackerServerListener
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:
handleExternalRequest
in interface TRTrackerServerListener
- Throws:
IOException
handleExternalRequest
public boolean handleExternalRequest(TRTrackerServerListener2.ExternalRequest request)
throws IOException
- Specified by:
handleExternalRequest
in interface TRTrackerServerListener2
- Throws:
IOException
getHostTorrent
public TRHostTorrent getHostTorrent(TOTorrent torrent)
- Description copied from interface:
TRHost
- returns the host torrent for the torrent if it exists, null otherwise
- Specified by:
getHostTorrent
in interface TRHost
- Returns:
addListener
public void addListener(TRHostListener l)
- Add and fire listener for each torrent already hosted
- Specified by:
addListener
in interface TRHost
removeListener
public void removeListener(TRHostListener l)
- Specified by:
removeListener
in interface TRHost
addListener2
public void addListener2(TRHostListener2 l)
- Specified by:
addListener2
in interface TRHost
removeListener2
public void removeListener2(TRHostListener2 l)
- Specified by:
removeListener2
in interface TRHost
torrentListenerRegistered
protected void torrentListenerRegistered()
serverCreated
public void serverCreated(TRTrackerServer server)
- Specified by:
serverCreated
in interface TRTrackerServerFactoryListener
serverDestroyed
public void serverDestroyed(TRTrackerServer server)
- Specified by:
serverDestroyed
in interface TRTrackerServerFactoryListener
preProcess
public void preProcess(TRTrackerServerRequest request)
throws TRTrackerServerException
- Specified by:
preProcess
in interface TRTrackerServerRequestListener
- Throws:
TRTrackerServerException
postProcess
public void postProcess(TRTrackerServerRequest request)
throws TRTrackerServerException
- Specified by:
postProcess
in interface TRTrackerServerRequestListener
- Throws:
TRTrackerServerException
close
public void close()
- Specified by:
close
in interface TRHost
authenticate
public boolean authenticate(String headers,
URL resource,
String user,
String password)
- Description copied from interface:
TRTrackerServerAuthenticationListener
- checks the password against user and returns true if OK
- Specified by:
authenticate
in interface TRTrackerServerAuthenticationListener
- Returns:
authenticate
public byte[] authenticate(URL resource,
String user)
- Description copied from interface:
TRTrackerServerAuthenticationListener
- returns SHA1 hash of pw for user if available
- Specified by:
authenticate
in interface TRTrackerServerAuthenticationListener
- Returns:
addAuthenticationListener
public void addAuthenticationListener(TRHostAuthenticationListener l)
- Specified by:
addAuthenticationListener
in interface TRHost
removeAuthenticationListener
public void removeAuthenticationListener(TRHostAuthenticationListener l)
- Specified by:
removeAuthenticationListener
in interface TRHost
startTorrent
protected void startTorrent(TRHostTorrentHostImpl torrent)
stopTorrent
protected void stopTorrent(TRHostTorrentHostImpl torrent)
addTrackerAnnounce
protected void addTrackerAnnounce(TOTorrent torrent)