java.lang.Object
net.i2p.router.update.UpdateHandler
- All Implemented Interfaces:
Updater
- Direct Known Subclasses:
NewsHandler
Handles the request to update the router by firing one or more 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 TypeFieldDescriptionprotected final RouterContextThe router context for configuration access.protected final ConsoleUpdateManagerThe update manager for coordinating updates.Constructor Summary
ConstructorsConstructorDescriptionUpdateHandler(RouterContext ctx, ConsoleUpdateManager mgr) Stores the context and the manager that owns the update runner.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 router context for configuration access._mgr
The update manager for coordinating updates.
Constructor Details
UpdateHandler
Stores the context and the manager that owns the update runner.- Parameters:
ctx- router context used to read the proxy setting and to run the downloadmgr- update manager that owns the runner and receives progress notifications
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