java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.client.RequestLeaseSetJob
All Implemented Interfaces:
Job

class RequestLeaseSetJobextends JobImpl
Async job to walk the client through generating a lease set. Sends the request to the client and queues a CheckLeaseRequestStatus job for timeout cleanup. On failure, calls failLeaseRequest() to clean up the pending LeaseRequestState so new requests can proceed.
  • Field Details

    • _log

      private final Log _log
      The log for the lease request.
    • _runner

      private final ClientConnectionRunner _runner
      The runner that asked for the lease set.
    • _requestState

      private final LeaseRequestState _requestState
      The state of the lease request.
    • DEFAULT_MAX_FUDGE

      private static final long DEFAULT_MAX_FUDGE
      Default maximum clock fudge.
      See Also:
    • PROP_MAX_FUDGE

      private static final String PROP_MAX_FUDGE
      Config key of the maximum clock fudge.
      See Also:
    • PROP_SEND_WAIT

      static final String PROP_SEND_WAIT
      Property overriding DEFAULT_SEND_WAIT: ms to wait for the client to drain its I2CP queue before failing the LeaseSet request.
      See Also:
    • TEN_MINUTES_MS

      private static final long TEN_MINUTES_MS
      Ten minutes, in milliseconds.
      See Also:
    • MAX_LEASE_FUTURE

      private static final long MAX_LEASE_FUTURE
      Most a lease may be in the future, the ten minute lease ceiling plus a small clock fudge, so requested leases never extend past the eleven minute tunnel lifetime. Must stay inside the fifteen minute network database lease cap.
      See Also:
    • CLOCK_FUDGE_FACTOR

      private static final long CLOCK_FUDGE_FACTOR
      Clock fudge allowed for lease times.
      See Also:
    • TIMEOUT_JITTER_MS

      private static final long TIMEOUT_JITTER_MS
      Jitter added to timeout to spread thundering-herd retries.
      See Also:
    • DEFAULT_SEND_WAIT

      static final long DEFAULT_SEND_WAIT
      Default wait for the client to make room in its I2CP queue before giving up.

      Deliberately far shorter than the request timeout this failure would otherwise cost: a client that is draining at all has usually freed a slot within a few dispatcher passes, and a client that is wedged should be failed quickly so the caller can rebuild rather than left holding a request that cannot succeed.

      See Also:
    • PROP_SEND_ATTEMPTS

      static final String PROP_SEND_ATTEMPTS
      Property overriding DEFAULT_SEND_ATTEMPTS: how many times to try the send before the request is declared failed.
      See Also:
    • DEFAULT_SEND_ATTEMPTS

      static final int DEFAULT_SEND_ATTEMPTS
      Attempts before giving up on a backed-up client. The router's request timeout is around a minute, so with a one-second first wait and doubling, five attempts span roughly 15 seconds. The client has to read one message in that time, and anything that cannot is not going to recover inside the request timeout either.
      See Also:
  • Constructor Details

  • Method Details

    • getName

      public String getName()
      Description copied from interface: Job
      Descriptive name of the task.
      Returns:
      the descriptive name of the task
    • runJob

      public void runJob()
      Description copied from interface: Job
      Actually perform the task. This call blocks until the Job is complete.
    • failEarlyRequest

      private void failEarlyRequest(String reason)
      Resolve a request that cannot be sent to the client. The claim makes onFailed fire at most once even when several paths (early validation, send failure, a timeout check) detect the same dead request, and the slot is always cleared through failLeaseRequest() so a later request can proceed.
      Parameters:
      reason - short description of the early failure, for the debug log