java.lang.Object
net.i2p.client.impl.HandlerImpl
net.i2p.client.impl.RequestLeaseSetMessageHandler
net.i2p.client.impl.RequestVariableLeaseSetMessageHandler
- All Implemented Interfaces:
I2CPMessageHandler
Handle I2CP RequestVariableLeaseSetMessage from the router by granting all leases, retaining the individual expiration time for each lease.
Field Summary
Fields inherited from class RequestLeaseSetMessageHandler
_ls2Type, MAX_TRANSIENT_SIGN_RETRIES, MIN_LS2_LEASE_TTL_MS, PROP_LS_TYPE, TRANSIENT_SIGN_RETRY_DELAY_MSModifier and TypeFieldDescriptionprotected int_ls2Type.(package private) static final intMaximum prompt re-runs of a request after a transient signing failure.(package private) static final longMinimum remaining lifetime required on a lease end relative to the LS2 published timestamp soLeaseSet2.writeHeader()does not reject the set with "LeaseSet expired".static final StringPROP_LS_TYPE — used for LS2.(package private) static final longDelay before a transient signing failure is re-run, in ms.Fields inherited from class HandlerImpl
_context, _logModifier and TypeFieldDescriptionprotected final I2PAppContextThe application context.protected final LogThe logger.Constructor Summary
ConstructorsConstructorDescriptionSets up the handler for the variable-lease-set message type.Method Summary
All MethodsModifier and TypeMethodDescriptionprotected voidhandleMessage(I2CPMessage message, I2PSessionImpl session, int attempt) Handle an incoming I2CP message, tracking how many prompt re-runs a transient signing failure has already scheduled for this request.Methods inherited from class RequestLeaseSetMessageHandler
ensurePositiveLs2Expiry, handleMessage, isSignable, isTransientSignFailure, removeLeaseSet, requiresLS2, scheduleSignRetry, signLeaseSet, signLeaseSet, validateEndpointCount, validateLeaseSetRequestModifier and TypeMethodDescription(package private) static longensurePositiveLs2Expiry(long leaseEnd, long published, long now) Floor a requested lease end so it remains strictly after both the LS2 published timestamp (second resolution) and the current time, leaving at leastRequestLeaseSetMessageHandler.MIN_LS2_LEASE_TTL_MSof validity.voidhandleMessage(I2CPMessage message, I2PSessionImpl session) Handle an incoming I2CP message.(package private) static booleanisSignable(LeaseSet leaseSet) Whether a LeaseSet can be signed.(package private) static booleanisTransientSignFailure(String reason) Is a signing failure transient — a stale or clock-skewed request the caller can fix with fresh data — rather than a permanent key or configuration error?voidremoveLeaseSet(Destination dest) Remove the cached lease info for the given destination.protected booleanrequiresLS2(I2PSessionImpl session) Do we send a LeaseSet or a LeaseSet2? As of 0.9.69, always use LS2 unless the router doesn't support it(package private) voidscheduleSignRetry(I2CPMessage message, I2PSessionImpl session, int attempt) Schedule a prompt re-run of a request whose signing failed transiently.protected booleansignLeaseSet(LeaseSet leaseSet, boolean isLS2, I2PSessionImpl session) Finish creating and signing the new LeaseSet and submitting it to the router.protected booleansignLeaseSet(LeaseSet leaseSet, boolean isLS2, I2PSessionImpl session, I2CPMessage message, int attempt) Finish creating and signing the new LeaseSet and submitting it to the router, with the originating request attached so a transient signing failure can schedule a prompt re-run instead of leaving the router to wait out its 60-second check timeout.(package private) static StringvalidateEndpointCount(int endpoints) Validate an endpoint count for the variable-length handler.(package private) static StringvalidateLeaseSetRequest(int endpoints, Date endDate) Validate a fixed-length LeaseSet request before any state is mutated.Methods inherited from class HandlerImpl
getType
Constructor Details
RequestVariableLeaseSetMessageHandler
Sets up the handler for the variable-lease-set message type.- Parameters:
context- application context shared with the rest of the I2CP handler chain
Method Details
handleMessage
Handle an incoming I2CP message, tracking how many prompt re-runs a transient signing failure has already scheduled for this request.- Overrides:
handleMessagein classRequestLeaseSetMessageHandler- Parameters:
message- the request from the routersession- the session the request is forattempt- number of transient sign retries already performed