Package org.klomp.snark
Class SnarkManager
- java.lang.Object
-
- org.klomp.snark.SnarkManager
-
- All Implemented Interfaces:
ClientApp
,CompleteListener
public class SnarkManager extends Object implements CompleteListener, ClientApp
Manage multiple snarks
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description SnarkManager(I2PAppContext ctx)
For embedded.SnarkManager(I2PAppContext ctx, String ctxPath, String ctxName)
For webapp.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDownloader(Snark torrent)
Add and start a FetchAndAdd task.void
addMagnet(String name, byte[] ih, String trackerURL, boolean updateStatus)
Add a torrent with the info hash alone (magnet / maggot)Snark
addMagnet(String name, byte[] ih, String trackerURL, boolean updateStatus, boolean autoStart, File dataDir, CompleteListener listener)
Add a torrent with the info hash alone (magnet / maggot) External use is for UpdateRunner.void
addMagnet(String name, byte[] ih, String trackerURL, boolean updateStatus, File dataDir)
Add a torrent with the info hash alone (magnet / maggot)void
addMessage(String message)
Use if it does not include a link.void
addMessage(Snark snark, String message)
A Snark.CompleteListener method.void
addMessageNoEscape(String message)
Use if it includes a link.boolean
addTorrent(MetaInfo metainfo, BitField bitfield, String filename, File baseFile, boolean dontAutoStart)
Add a torrent from a MetaInfo.boolean
areFilesPublic()
void
clearMessages()
void
clearMessages(int id)
Clear through this idboolean
copyAndAddTorrent(File fromfile, String filename, File dataDir)
Add a torrent from a file not in the torrent directory.void
deleteMagnet(Snark snark)
Stop and delete a torrent running in magnet modevoid
fatal(Snark snark, String error)
A Snark.CompleteListener method.File
getConfigDir()
For RPCFile
getDataDir()
String
getDisplayName()
ClientApp method.List<UIMessages.Message>
getMessages()
newest lastString
getName()
ClientApp method.int
getPageSize()
For GUIList<String>
getPrivateTrackers()
int
getRefreshDelaySeconds()
long[]
getSavedAddedAndCompleted(Snark snark)
Get setting for a torrent from the config file.CommentSet
getSavedComments(Snark snark)
The conmments for a torrentboolean
getSavedCommentsEnabled(Snark snark)
Get setting for comments enabled from the config file.boolean
getSavedPreserveNamesSetting(Snark snark)
Get setting for a torrent from the config file.BitField
getSavedTorrentBitField(Snark snark)
Get the saved bitfield for a torrent from the config file.long
getSavedTorrentTime(Snark snark)
Get the timestamp for a torrent from the config file.long
getSavedUploaded(Snark snark)
Get setting for a torrent from the config file.List<Tracker>
getSortedTrackers()
Sorted copyClientAppState
getState()
ClientApp method.String
getTheme()
Get current theme.String
getThemeIconSet()
Get the path to the preferred embedded icons for toImg, "solid/" for dark and light, "" for everything else.static String[]
getThemes()
Get all themesSnark
getTorrent(String filename)
Grab the torrent given the (canonical) filename of the .torrent fileSnark
getTorrentByBaseName(String filename)
Grab the torrent given the base name of the storageSnark
getTorrentByInfoHash(byte[] infohash)
Grab the torrent given the info hashCollection<Snark>
getTorrents()
UnmodifiableMap<String,Tracker>
getTrackerMap()
Unsorted map of name to Tracker object Modifiable, not a copyCollection<Tracker>
getTrackers()
Unsorted, do not modifyboolean
getUniversalTheming()
String
gotMetaInfo(Snark snark)
We transitioned from magnet mode, we have now initialized our metainfo and storage.void
gotPiece(Snark snark)
A Snark.CompleteListener method.boolean
hasModifiedTrackers()
Has the default tracker list been modified?boolean
isCollapsePanelsEnabled()
boolean
isSmartSortEnabled()
boolean
isStopping()
Set<String>
listTorrentFiles()
Set of canonical .torrent filenames that we are dealing with.void
loadConfig(String filename)
void
loadSavedFilePriorities(Snark snark)
Get the saved priorities for a torrent from the config file.void
locked_saveComments(Snark snark, CommentSet comments)
Save the conmments for a torrent Caller must synchronize on comments.void
recheckTorrent(Snark snark)
Threaded.void
removeMagnetStatus(byte[] ih)
Remove the magnet marker from the config file.void
removeTorrent(String filename)
Stop the torrent and delete the torrent file itself, but leaving the data behind.void
saveConfig()
void
saveMagnetStatus(byte[] ih, String dir, String trackerURL, String dn)
Just remember we have it.void
saveOpenTrackers(List<String> ot)
void
savePrivateTrackers(List<String> pt)
void
saveTorrentStatus(Snark snark)
Save the completion status of a torrent and other data in the config file for that torrent.void
saveTrackerMap()
void
setDefaultTrackerMap()
void
setSavedCommentsEnabled(Snark snark, boolean yes)
Set setting for comments enabled in the config file.boolean
shouldAutoStart()
void
shutdown(String[] args)
ClientApp method.void
start()
Caller _must_ call loadConfig(file) before this if setting new values for i2cp host/port or i2psnark.dirvoid
startAllTorrents()
If not connected, thread it, otherwise inlinevoid
startTorrent(byte[] infoHash)
If not connected, thread it, otherwise inlinevoid
startTorrent(Snark snark)
If not connected, thread it, otherwise inlinevoid
startup()
ClientApp method.void
stop()
void
stopAllTorrents(boolean finalShutdown)
Stop all running torrents, and close the tunnel after a delay to allow for announces.Snark
stopTorrent(String filename, boolean shouldRemove)
Stop the torrent, leaving it on the list of torrents unless told to remove it.void
stopTorrent(Snark torrent, boolean shouldRemove)
Stop the torrent, leaving it on the list of torrents unless told to remove it.void
torrentComplete(Snark snark)
A Snark.CompleteListener method.void
updateConfig(String dataDir, boolean filesPublic, boolean autoStart, boolean smartSort, String refreshDelay, String startDelay, String pageSize, String seedPct, String eepHost, String eepPort, String i2cpHost, String i2cpPort, String i2cpOpts, String upLimit, String upBW, boolean useOpenTrackers, boolean useDHT, String theme, String lang, boolean enableRatings, boolean enableComments, String commentName, boolean collapsePanels)
all params may be null or need trimmingvoid
updateStatus(Snark snark)
A Snark.CompleteListener method.I2PSnarkUtil
util()
hook to I2PSnarkUtil for the servlet
-
-
-
Field Detail
-
PROP_I2CP_HOST
public static final String PROP_I2CP_HOST
- See Also:
- Constant Field Values
-
PROP_I2CP_PORT
public static final String PROP_I2CP_PORT
- See Also:
- Constant Field Values
-
PROP_I2CP_OPTS
public static final String PROP_I2CP_OPTS
- See Also:
- Constant Field Values
-
PROP_UPLOADERS_TOTAL
public static final String PROP_UPLOADERS_TOTAL
- See Also:
- Constant Field Values
-
PROP_UPBW_MAX
public static final String PROP_UPBW_MAX
- See Also:
- Constant Field Values
-
PROP_DIR
public static final String PROP_DIR
- See Also:
- Constant Field Values
-
PROP_FILES_PUBLIC
public static final String PROP_FILES_PUBLIC
- See Also:
- Constant Field Values
-
PROP_OLD_AUTO_START
public static final String PROP_OLD_AUTO_START
- See Also:
- Constant Field Values
-
PROP_AUTO_START
public static final String PROP_AUTO_START
- See Also:
- Constant Field Values
-
DEFAULT_AUTO_START
public static final String DEFAULT_AUTO_START
- See Also:
- Constant Field Values
-
PROP_STARTUP_DELAY
public static final String PROP_STARTUP_DELAY
- See Also:
- Constant Field Values
-
PROP_REFRESH_DELAY
public static final String PROP_REFRESH_DELAY
- See Also:
- Constant Field Values
-
PROP_PAGE_SIZE
public static final String PROP_PAGE_SIZE
- See Also:
- Constant Field Values
-
RC_PROP_THEME
public static final String RC_PROP_THEME
- See Also:
- Constant Field Values
-
RC_PROP_UNIVERSAL_THEMING
public static final String RC_PROP_UNIVERSAL_THEMING
- See Also:
- Constant Field Values
-
PROP_THEME
public static final String PROP_THEME
- See Also:
- Constant Field Values
-
DEFAULT_THEME
public static final String DEFAULT_THEME
- See Also:
- Constant Field Values
-
PROP_COLLAPSE_PANELS
public static final String PROP_COLLAPSE_PANELS
- Since:
- 0.9.32
- See Also:
- Constant Field Values
-
PROP_OPENTRACKERS
public static final String PROP_OPENTRACKERS
- See Also:
- Constant Field Values
-
PROP_PRIVATETRACKERS
public static final String PROP_PRIVATETRACKERS
- See Also:
- Constant Field Values
-
MIN_UP_BW
public static final int MIN_UP_BW
- See Also:
- Constant Field Values
-
DEFAULT_MAX_UP_BW
public static final int DEFAULT_MAX_UP_BW
- See Also:
- Constant Field Values
-
DEFAULT_STARTUP_DELAY
public static final int DEFAULT_STARTUP_DELAY
- See Also:
- Constant Field Values
-
DEFAULT_REFRESH_DELAY_SECS
public static final int DEFAULT_REFRESH_DELAY_SECS
- See Also:
- Constant Field Values
-
DEFAULT_TUNNEL_QUANTITY
public static final int DEFAULT_TUNNEL_QUANTITY
- See Also:
- Constant Field Values
-
CONFIG_DIR_SUFFIX
public static final String CONFIG_DIR_SUFFIX
- See Also:
- Constant Field Values
-
DEFAULT_BACKUP_TRACKER
public static final String DEFAULT_BACKUP_TRACKER
URL. This is our equivalent to router.utorrent.com for bootstrap- See Also:
- Constant Field Values
-
PROP_TRACKERS
public static final String PROP_TRACKERS
comma delimited list of name=announceURL=baseURL for the trackers to be displayed- See Also:
- Constant Field Values
-
MAX_FILES_PER_TORRENT
public static final int MAX_FILES_PER_TORRENT
hardcoded for sanity. perhaps this should be customizable, for people who increase their ulimit, etc.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SnarkManager
public SnarkManager(I2PAppContext ctx)
For embedded.
-
SnarkManager
public SnarkManager(I2PAppContext ctx, String ctxPath, String ctxName)
For webapp.- Parameters:
ctxPath
- generally "/i2psnark"ctxName
- generally "i2psnark"- Since:
- 0.9.6
-
-
Method Detail
-
start
public void start()
Caller _must_ call loadConfig(file) before this if setting new values for i2cp host/port or i2psnark.dir
-
stop
public void stop()
-
isStopping
public boolean isStopping()
- Since:
- 0.9.1
-
startup
public void startup()
ClientApp method. Does nothing. Doesn't matter, we are only registering.
-
shutdown
public void shutdown(String[] args)
ClientApp method. Does nothing. Doesn't matter, we are only registering.
-
getState
public ClientAppState getState()
ClientApp method. Doesn't matter, we are only registering.
-
getName
public String getName()
ClientApp method.
-
getDisplayName
public String getDisplayName()
ClientApp method.- Specified by:
getDisplayName
in interfaceClientApp
- Returns:
- non-null
- Since:
- 0.9.30
-
util
public I2PSnarkUtil util()
hook to I2PSnarkUtil for the servlet
-
addMessage
public void addMessage(String message)
Use if it does not include a link. Escapes '<' and '>' before queueing
-
addMessageNoEscape
public void addMessageNoEscape(String message)
Use if it includes a link. Does not escape '<' and '>' before queueing- Since:
- 0.9.14.1
-
getMessages
public List<UIMessages.Message> getMessages()
newest last
-
clearMessages
public void clearMessages()
- Since:
- 0.9
-
clearMessages
public void clearMessages(int id)
Clear through this id- Since:
- 0.9.33
-
areFilesPublic
public boolean areFilesPublic()
- Returns:
- default false
- Since:
- 0.8.9
-
shouldAutoStart
public boolean shouldAutoStart()
- Specified by:
shouldAutoStart
in interfaceCompleteListener
-
isSmartSortEnabled
public boolean isSmartSortEnabled()
- Returns:
- default true
- Since:
- 0.9.23
-
isCollapsePanelsEnabled
public boolean isCollapsePanelsEnabled()
- Returns:
- default true
- Since:
- 0.9.32
-
getRefreshDelaySeconds
public int getRefreshDelaySeconds()
- Returns:
- -1 for never
- Since:
- 0.8.9
-
getPageSize
public int getPageSize()
For GUI- Since:
- 0.9.6
-
getDataDir
public File getDataDir()
-
getConfigDir
public File getConfigDir()
For RPC- Since:
- 0.9.30
-
getSavedComments
public CommentSet getSavedComments(Snark snark)
The conmments for a torrent- Specified by:
getSavedComments
in interfaceCompleteListener
- Returns:
- null if none
- Since:
- 0.9.31
-
locked_saveComments
public void locked_saveComments(Snark snark, CommentSet comments)
Save the conmments for a torrent Caller must synchronize on comments.- Specified by:
locked_saveComments
in interfaceCompleteListener
- Parameters:
comments
- non-null- Since:
- 0.9.31
-
loadConfig
public void loadConfig(String filename)
- Parameters:
filename
- null to set initial defaults
-
getUniversalTheming
public boolean getUniversalTheming()
- Since:
- 0.9.31
-
getTheme
public String getTheme()
Get current theme.- Returns:
- String -- the current theme
-
getThemeIconSet
public String getThemeIconSet()
Get the path to the preferred embedded icons for toImg, "solid/" for dark and light, "" for everything else. If you add a theme with a new icon set, then you need to add a corresponding condition here.- Returns:
- String "solid/" or ""
- Since:
- 0.9.48
-
getThemes
public static String[] getThemes()
Get all themes- Returns:
- String[] -- Array of all the themes found, non-null, unsorted
-
updateConfig
public void updateConfig(String dataDir, boolean filesPublic, boolean autoStart, boolean smartSort, String refreshDelay, String startDelay, String pageSize, String seedPct, String eepHost, String eepPort, String i2cpHost, String i2cpPort, String i2cpOpts, String upLimit, String upBW, boolean useOpenTrackers, boolean useDHT, String theme, String lang, boolean enableRatings, boolean enableComments, String commentName, boolean collapsePanels)
all params may be null or need trimming
-
getPrivateTrackers
public List<String> getPrivateTrackers()
- Returns:
- non-null, fixed size, may be empty or unmodifiable
- Since:
- 0.9.1
-
saveOpenTrackers
public void saveOpenTrackers(List<String> ot)
- Parameters:
ot
- null to restore default- Since:
- 0.9.1
-
savePrivateTrackers
public void savePrivateTrackers(List<String> pt)
- Parameters:
pt
- null ok, default is none- Since:
- 0.9.1
-
saveConfig
public void saveConfig()
-
listTorrentFiles
public Set<String> listTorrentFiles()
Set of canonical .torrent filenames that we are dealing with. An unsynchronized copy.
-
getTorrent
public Snark getTorrent(String filename)
Grab the torrent given the (canonical) filename of the .torrent file- Returns:
- Snark or null
-
getTorrents
public Collection<Snark> getTorrents()
Unmodifiable- Since:
- 0.9.4
-
getTorrentByBaseName
public Snark getTorrentByBaseName(String filename)
Grab the torrent given the base name of the storage- Parameters:
filename
- must be the filtered name, which may be different than the metainfo's name- Returns:
- Snark or null
- Since:
- 0.7.14
-
getTorrentByInfoHash
public Snark getTorrentByInfoHash(byte[] infohash)
Grab the torrent given the info hash- Returns:
- Snark or null
- Since:
- 0.8.4
-
addMagnet
public void addMagnet(String name, byte[] ih, String trackerURL, boolean updateStatus)
Add a torrent with the info hash alone (magnet / maggot)- Parameters:
name
- hex or b32 name from the magnet linkih
- 20 byte info hashtrackerURL
- may be nullupdateStatus
- should we add this magnet to the config file, to save it across restarts, in case we don't get the metadata before shutdown?- Throws:
RuntimeException
- via Snark.fatal()- Since:
- 0.8.4
-
addMagnet
public void addMagnet(String name, byte[] ih, String trackerURL, boolean updateStatus, File dataDir)
Add a torrent with the info hash alone (magnet / maggot)- Parameters:
name
- hex or b32 name from the magnet linkih
- 20 byte info hashtrackerURL
- may be nullupdateStatus
- should we add this magnet to the config file, to save it across restarts, in case we don't get the metadata before shutdown?dataDir
- must exist, or null to default to snark data directory- Throws:
RuntimeException
- via Snark.fatal()- Since:
- 0.9.17
-
addMagnet
public Snark addMagnet(String name, byte[] ih, String trackerURL, boolean updateStatus, boolean autoStart, File dataDir, CompleteListener listener)
Add a torrent with the info hash alone (magnet / maggot) External use is for UpdateRunner.- Parameters:
name
- hex or b32 name from the magnet linkih
- 20 byte info hashtrackerURL
- may be nullupdateStatus
- should we add this magnet to the config file, to save it across restarts, in case we don't get the metadata before shutdown?dataDir
- must exist, or null to default to snark data directorylistener
- to intercept callbacks, should pass through to this- Returns:
- the new Snark or null on failure
- Throws:
RuntimeException
- via Snark.fatal()- Since:
- 0.9.4
-
deleteMagnet
public void deleteMagnet(Snark snark)
Stop and delete a torrent running in magnet mode- Parameters:
snark
- a torrent with a fake file name ("Magnet xxxx")- Since:
- 0.8.4
-
addDownloader
public void addDownloader(Snark torrent)
Add and start a FetchAndAdd task. Remove it with deleteMagnet().- Parameters:
torrent
- must be instanceof FetchAndAdd- Throws:
RuntimeException
- via Snark.fatal()?- Since:
- 0.9.1
-
addTorrent
public boolean addTorrent(MetaInfo metainfo, BitField bitfield, String filename, File baseFile, boolean dontAutoStart) throws IOException
Add a torrent from a MetaInfo. Save the MetaInfo data to filename. Holds the snarks lock to prevent interference from the DirMonitor. This verifies that a torrent with this infohash is not already added. This may take a LONG time to create or check the storage. Called from servlet. This is only for the 'create torrent' form.- Parameters:
metainfo
- the metainfo for the torrentbitfield
- the current completion status of the torrent, or nullfilename
- the absolute path to save the metainfo to, generally ending in ".torrent", which is also the name of the torrent Must be a filesystem-safe name. If null, will generate a name from the metainfo.baseFile
- may be null, if so look in rootDataDir- Returns:
- success
- Throws:
RuntimeException
- via Snark.fatal()IOException
- Since:
- 0.8.4
-
copyAndAddTorrent
public boolean copyAndAddTorrent(File fromfile, String filename, File dataDir) throws IOException
Add a torrent from a file not in the torrent directory. Copy the file to filename. Holds the snarks lock to prevent interference from the DirMonitor. Caller must verify this torrent is not already added. This may take a LONG time to create or check the storage.- Parameters:
fromfile
- where the file is now, presumably in a temp directory somewherefilename
- the absolute path to save the metainfo to, generally ending in ".torrent", which is also the name of the torrent Must be a filesystem-safe name.dataDir
- must exist, or null to default to snark data directory- Returns:
- success
- Throws:
RuntimeException
- via Snark.fatal()IOException
- Since:
- 0.8.4
-
getSavedTorrentTime
public long getSavedTorrentTime(Snark snark)
Get the timestamp for a torrent from the config file. A Snark.CompleteListener method.- Specified by:
getSavedTorrentTime
in interfaceCompleteListener
-
getSavedTorrentBitField
public BitField getSavedTorrentBitField(Snark snark)
Get the saved bitfield for a torrent from the config file. Convert "." to a full bitfield. A Snark.CompleteListener method.- Specified by:
getSavedTorrentBitField
in interfaceCompleteListener
-
loadSavedFilePriorities
public void loadSavedFilePriorities(Snark snark)
Get the saved priorities for a torrent from the config file.- Since:
- 0.8.1
-
getSavedPreserveNamesSetting
public boolean getSavedPreserveNamesSetting(Snark snark)
Get setting for a torrent from the config file.- Specified by:
getSavedPreserveNamesSetting
in interfaceCompleteListener
- Returns:
- setting, false if not found
- Since:
- 0.9.15
-
getSavedUploaded
public long getSavedUploaded(Snark snark)
Get setting for a torrent from the config file.- Specified by:
getSavedUploaded
in interfaceCompleteListener
- Returns:
- setting, 0 if not found
- Since:
- 0.9.15
-
getSavedAddedAndCompleted
public long[] getSavedAddedAndCompleted(Snark snark)
Get setting for a torrent from the config file.- Returns:
- non-null, rv[0] is added time or 0; rv[1] is completed time or 0
- Since:
- 0.9.23
-
getSavedCommentsEnabled
public boolean getSavedCommentsEnabled(Snark snark)
Get setting for comments enabled from the config file. Caller must first check global I2PSnarkUtil.commentsEnabled() Default true.- Since:
- 0.9.31
-
setSavedCommentsEnabled
public void setSavedCommentsEnabled(Snark snark, boolean yes)
Set setting for comments enabled in the config file.- Since:
- 0.9.31
-
saveTorrentStatus
public void saveTorrentStatus(Snark snark)
Save the completion status of a torrent and other data in the config file for that torrent. Does nothing for magnets.- Since:
- 0.9.15
-
saveMagnetStatus
public void saveMagnetStatus(byte[] ih, String dir, String trackerURL, String dn)
Just remember we have it. This used to simply store a line in the config file, but now we also save it in its own config file, just like other torrents, so we can remember the directory, tracker, etc.- Parameters:
dir
- may be nulltrackerURL
- may be nulldn
- may be null- Since:
- 0.8.4
-
removeMagnetStatus
public void removeMagnetStatus(byte[] ih)
Remove the magnet marker from the config file.- Since:
- 0.8.4
-
stopTorrent
public Snark stopTorrent(String filename, boolean shouldRemove)
Stop the torrent, leaving it on the list of torrents unless told to remove it. If shouldRemove is true, removes the config file also.
-
stopTorrent
public void stopTorrent(Snark torrent, boolean shouldRemove)
Stop the torrent, leaving it on the list of torrents unless told to remove it. If shouldRemove is true, removes the config file also.- Since:
- 0.8.4
-
removeTorrent
public void removeTorrent(String filename)
Stop the torrent and delete the torrent file itself, but leaving the data behind. Removes saved config file also. Holds the snarks lock to prevent interference from the DirMonitor.
-
torrentComplete
public void torrentComplete(Snark snark)
A Snark.CompleteListener method.- Specified by:
torrentComplete
in interfaceCompleteListener
-
updateStatus
public void updateStatus(Snark snark)
A Snark.CompleteListener method.- Specified by:
updateStatus
in interfaceCompleteListener
-
gotMetaInfo
public String gotMetaInfo(Snark snark)
We transitioned from magnet mode, we have now initialized our metainfo and storage. The listener should now call getMetaInfo() and save the data to disk. A Snark.CompleteListener method.- Specified by:
gotMetaInfo
in interfaceCompleteListener
- Returns:
- the new name for the torrent or null on error
- Since:
- 0.8.4
-
fatal
public void fatal(Snark snark, String error)
A Snark.CompleteListener method.- Specified by:
fatal
in interfaceCompleteListener
- Since:
- 0.9
-
addMessage
public void addMessage(Snark snark, String message)
A Snark.CompleteListener method.- Specified by:
addMessage
in interfaceCompleteListener
- Since:
- 0.9.2
-
gotPiece
public void gotPiece(Snark snark)
A Snark.CompleteListener method.- Specified by:
gotPiece
in interfaceCompleteListener
- Since:
- 0.9.4
-
getTrackerMap
public Map<String,Tracker> getTrackerMap()
Unsorted map of name to Tracker object Modifiable, not a copy- Since:
- 0.9.1
-
getTrackers
public Collection<Tracker> getTrackers()
Unsorted, do not modify
-
hasModifiedTrackers
public boolean hasModifiedTrackers()
Has the default tracker list been modified?- Since:
- 0.9.35
-
setDefaultTrackerMap
public void setDefaultTrackerMap()
- Since:
- 0.9
-
saveTrackerMap
public void saveTrackerMap()
- Since:
- 0.9
-
startTorrent
public void startTorrent(byte[] infoHash)
If not connected, thread it, otherwise inline- Throws:
RuntimeException
- via Snark.fatal()- Since:
- 0.9.1
-
startTorrent
public void startTorrent(Snark snark)
If not connected, thread it, otherwise inline- Throws:
RuntimeException
- via Snark.fatal()- Since:
- 0.9.23
-
startAllTorrents
public void startAllTorrents()
If not connected, thread it, otherwise inline- Since:
- 0.9.1
-
stopAllTorrents
public void stopAllTorrents(boolean finalShutdown)
Stop all running torrents, and close the tunnel after a delay to allow for announces. If called at router shutdown via Jetty shutdown hook -> webapp destroy() -> stop(), the tunnel won't actually be closed as the SimpleTimer2 is already shutdown or will be soon, so we delay a few seconds inline.- Parameters:
finalShutdown
- if true, sleep at the end if any torrents were running- Since:
- 0.9.1
-
recheckTorrent
public void recheckTorrent(Snark snark)
Threaded. Torrent must be stopped.- Since:
- 0.9.23
-
-