java.lang.Object
org.klomp.snark.UpdateHandler
- All Implemented Interfaces:
Updater
Handles the request to update the router by firing up a magnet.
EepGet calls to download the latest signed update file and displaying the status to anyone who asks.After the download completes the signed update file is verified with TrustedUpdate, and if it's authentic the payload of the signed update file is unpacked and the router is restarted to complete the update process. This does not do any checking, that is handled by the NewsFetcher.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final I2PAppContextThe context the update manager runs in.private final SnarkManagerThe torrents paused while an update is installed.private final UpdateManagerThe manager that checks and installs updates.Constructor Summary
ConstructorsConstructorDescriptionUpdateHandler(I2PAppContext ctx, UpdateManager umgr, SnarkManager smgr) Wire an updater to the router's update manager and the torrent client.Method Summary
All MethodsModifier and TypeMethodDescriptionupdate(UpdateType type, UpdateMethod method, List<URI> updateSources, String id, String newVersion, long maxTime) Start a download and return a handle to the download task.
Field Details
_context
The context the update manager runs in._umgr
The manager that checks and installs updates._smgr
The torrents paused while an update is installed.
Constructor Details
UpdateHandler
Wire an updater to the router's update manager and the torrent client.- Parameters:
ctx- the application context used by the download and the torrent clientumgr- the update manager that tracks and cancels running update taskssmgr- the torrent client that fetches the signed update file by magnet
Method Details
update
public UpdateTask update(UpdateType type, UpdateMethod method, List<URI> updateSources, String id, String newVersion, long maxTime) Start a download and return a handle to the download task. Should not block.- Specified by:
updatein interfaceUpdater- Parameters:
type- selects what is being fetched, e.g.UpdateType.ROUTER_SIGNEDmethod- how it is fetched, e.g.UpdateMethod.HTTPover I2PupdateSources- Where to get the new version fromid- plugin name or ignorednewVersion- new version to downloadmaxTime- how long you have- Returns:
- active task or null if unable to download