net.i2p.router.tasks

## Class Republish

- java.lang.Object
- - net.i2p.router.tasks.Republish

- All Implemented Interfaces:
    SimpleTimer.TimedEvent

      public class Republish
      extends Object
      implements SimpleTimer.TimedEvent

  Router information publisher for network database synchronization.

  This class periodically publishes the router's RouterInfo to the distributed network database (netdb) to ensure the router remains discoverable and reachable by other peers. Regular publication is essential for maintaining network connectivity and participation.

  Publication Process:

  - Retrieves current RouterInfo from router
  - Validates RouterInfo integrity and timestamps
  - Publishes to floodfill peers in network database
  - Handles clock skew and timestamp issues
  - Triggers identity rebuild if needed

  Error Handling:

  - Detects and handles clock skew issues
  - Rebuilds router identity on validation failures
  - Logs detailed error information for debugging
  - Recovers from temporary network issues

  Clock Skew Detection:

  - Detects large time discrepancies (>60 seconds)
  - Rebuilds RouterInfo with current time
  - Prevents network database rejection
  - Maintains router identity continuity

  Network Integration:

  - Ensures router remains discoverable by peers
  - Maintains up-to-date routing information
  - Supports network topology and routing
  - Enables tunnel building and peer connections

  Regular publication is critical for router participation in the I2P network. Without periodic republishing, routers would become unreachable and unable to participate in tunnel creation or network routing.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Republish(RouterContext ctx)` Create a new router info republisher.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `timeReached()` Publish the router's info to the network database.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Republish

          public Republish(RouterContext ctx)

      Create a new router info republisher.
      Parameters:
        `ctx` - the router context for accessing router services

  - ### Method Detail

    - #### timeReached

          public void timeReached()

      Publish the router's info to the network database. Retrieves the current RouterInfo and publishes it to the netdb. If the RouterInfo is invalid (due to clock skew or other issues), attempts to rebuild the router identity. This method handles clock skew detection and will trigger a router identity rebuild if significant time discrepancies are detected.
      Specified by:
        `timeReached` in interface `SimpleTimer.TimedEvent`