java.lang.Object
net.i2p.router.update.UnsignedUpdateHandler
All Implemented Interfaces:
Checker, Updater

class UnsignedUpdateHandlerextends Object implements Checker, Updater

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 Details

    • _context

      private final RouterContext _context
      The router context the handler runs in.
    • _mgr

      private final ConsoleUpdateManager _mgr
      The manager that installs the update.
  • Constructor Details

    • UnsignedUpdateHandler

      public UnsignedUpdateHandler(RouterContext ctx, ConsoleUpdateManager mgr)
      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 access
      mgr - console update manager that runs the download and shows status
  • Method Details

    • getUpdateSources

      public List<URI> getUpdateSources()
      The single download location for the unsigned update, taken from the ConfigUpdateHandler zip URL property. Unlike the signed sources this list never has more than one entry.
      Returns:
      null if none
    • 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:
      check in interface Checker
      Parameters:
      type - the kind of update to look for, e.g. UpdateType.ROUTER_SIGNED
      method - the transport to fetch it over, e.g. UpdateMethod.HTTP
      id - plugin name or ignored
      currentVersion - ignored, we use time stored in a property
      maxTime - 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:
      update in interface Updater
      Parameters:
      type - selects what is being fetched, e.g. UpdateType.ROUTER_SIGNED
      method - how it is fetched, e.g. UpdateMethod.HTTP over I2P
      updateSources - Where to get the new version from
      id - plugin name or ignored
      newVersion - new version to download
      maxTime - how long you have
      Returns:
      active task or null if unable to download