java.lang.Object
net.i2p.router.update.UnsignedUpdateHandler
Handles the request to update the router by firing off an EepGet call to download the latest unsigned zip file and displaying the status to anyone who asks.
After the download completes the signed update file is copied to the router directory, and if configured the router is restarted to complete the update process.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router context the handler runs in.private final ConsoleUpdateManagerThe manager that installs the update.Constructor Summary
ConstructorsConstructorDescriptionHold the router context and the update manager that the checker and runner created here need; no work happens in the constructor.Method Summary
All MethodsModifier and TypeMethodDescriptioncheck(UpdateType type, UpdateMethod method, String id, String currentVersion, long maxTime) Offer a checker for the unsigned router zip, or nothing at all if this type or method is not the one being asked about, no source is configured, or no previous check time has been stamped yet.The single download location for the unsigned update, taken from theConfigUpdateHandlerzip URL property.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.
Field Details
_context
The router context the handler runs in._mgr
The manager that installs the update.
Constructor Details
UnsignedUpdateHandler
Hold the router context and the update manager that the checker and runner created here need; no work happens in the constructor.- Parameters:
ctx- router context used for config and clock accessmgr- console update manager that runs the download and shows status
Method Details
getUpdateSources
check
public UpdateTask check(UpdateType type, UpdateMethod method, String id, String currentVersion, long maxTime) Offer a checker for the unsigned router zip, or nothing at all if this type or method is not the one being asked about, no source is configured, or no previous check time has been stamped yet.- Specified by:
checkin interfaceChecker- Parameters:
type- the kind of update to look for, e.g.UpdateType.ROUTER_SIGNEDmethod- the transport to fetch it over, e.g.UpdateMethod.HTTPid- plugin name or ignoredcurrentVersion- ignored, we use time stored in a propertymaxTime- how long you have- Returns:
- active task or null if unable to check
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