java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.networkdb.PublishLocalRouterInfoJob
- All Implemented Interfaces:
Job
Publish the local router's RouterInfo periodically. NOTE - this also creates and signs the RI. This is run immediately at startup... but doesn't really send to the floodfills until the second time it runs.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classArbitrary sort so we can attempt to compare costs between two RIs to see if they have changed.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LogLogger for this class.private final AtomicIntegerLong enough to give us time to start up, but less than 20m, when we start accepting tunnels and could be an IBGW.private static final longDon't store if somebody else stored it recently.private static final longToo short and the network puts a big connection load on the floodfills since we store directly.Constructor Summary
ConstructorsConstructorDescriptionSets up the job and its logger from the given router context.Method Summary
All MethodsMethods inherited from class JobImpl
dropped, getContext, getJobId, getMadeReadyOn, getTiming, madeReady, requeue, toStringModifier and TypeMethodDescriptionvoiddropped()Default implementation does nothing.final RouterContextThe router context that this job belongs to.longgetJobId()The unique job ID for this job.longThe timestamp when this job was last made ready for execution.The timing object for this job.voidmadeReady(long now) For JobQueue only, not for external use.protected voidrequeue(long delayMs) Requeue this job to run after the specified delay.toString()
Field Details
_log
Logger for this class.MIN_PUBLISH_DELAY
private static final long MIN_PUBLISH_DELAYDon't store if somebody else stored it recently. Publishes within this window of the last store are skipped; the normal publish interval fromgetDelay()is 7-11 minutes.- See Also:
PUBLISH_DELAY
private static final long PUBLISH_DELAYToo short and the network puts a big connection load on the floodfills since we store directly. Too long and the floodfill will drop us - timeout is 60 minutes.- See Also:
_runCount
Long enough to give us time to start up, but less than 20m, when we start accepting tunnels and could be an IBGW. Actually, we need this soon if we are a new router or other routers have forgotten about us, else we can't build IB exploratory tunnels.First publish after netdb ready is now done via state machine in
Router.setNetDbReady(), so we probably don't need this anymore.
Constructor Details
PublishLocalRouterInfoJob
Sets up the job and its logger from the given router context.- Parameters:
ctx- the router context whose log manager supplies the job logger
Method Details
getName
runJob
public void runJob()Publish the local RouterInfo, or requeue if it is not yet time.getDelay
public long getDelay()Delay until the next RouterInfo publish.- Returns:
- how long to wait before publishing again, in milliseconds, randomised within a third of
PUBLISH_DELAYand then divided by four