java.lang.Object
net.i2p.router.JobImpl
net.i2p.router.client.LookupDestJob
- All Implemented Interfaces:
Job
Look up the lease of a hash, to convert it to a Destination for the client. Or, since 0.9.11, lookup a host name in the naming service.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classJob cleaning up when the lookup finishes.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BlindDataThe blinded lookup data, null if not blinded.private final HashThe local destination to search from, null if none.private final HashThe hash being looked up.private final LogLogger for the destination lookup job.private final StringThe local name to look up, null if a hash was given.private final longThe client request id to reply to.private final ClientConnectionRunnerThe client runner that asked for the lookup.private final SessionIdThe session that asked for the lookup.private final longTime allowed for the lookup.private static final longTime allowed for a lookup unless given one.Constructor Summary
ConstructorsConstructorDescriptionLookupDestJob(RouterContext context, ClientConnectionRunner runner, long reqID, long timeout, SessionId sessID, Hash h, String name, Hash fromLocalDest) One of h or name non-null.LookupDestJob(RouterContext context, ClientConnectionRunner runner, Hash h, Hash fromLocalDest) Create a lookup job with the default timeout.Method Summary
Modifier and TypeMethodDescriptiongetName()Return the name.private voidSends the destination found to the client.private voidReturn the request ID or failed hash so the client can correlate replies with requests.private voidreturnFail(int code) Return the request ID or failed hash so the client can correlate replies with requests.voidrunJob()Execute the job.Methods 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 the destination lookup job._runner
The client runner that asked for the lookup._reqID
private final long _reqIDThe client request id to reply to._timeout
private final long _timeoutTime allowed for the lookup._hash
The hash being looked up._name
The local name to look up, null if a hash was given._sessID
The session that asked for the lookup._fromLocalDest
The local destination to search from, null if none._blindData
The blinded lookup data, null if not blinded.DEFAULT_TIMEOUT
private static final long DEFAULT_TIMEOUTTime allowed for a lookup unless given one.- See Also:
Constructor Details
LookupDestJob
public LookupDestJob(RouterContext context, ClientConnectionRunner runner, Hash h, Hash fromLocalDest) Create a lookup job with the default timeout.- Parameters:
context- the router contextrunner- the client connection requesting the lookuph- the destination hash to look upfromLocalDest- the local destination to send the reply to, or null
LookupDestJob
public LookupDestJob(RouterContext context, ClientConnectionRunner runner, long reqID, long timeout, SessionId sessID, Hash h, String name, Hash fromLocalDest) One of h or name non-null.For hash or b32 name, the dest will be returned if the LS can be found, even if the dest uses unsupported crypto.
- Parameters:
context- the router context the job runs againstrunner- the connection the resolved LeaseSet is handed to, or null if the caller only wants the lookup performedreqID- must be >= 0 if name != nulltimeout- how long to wait for the LeaseSet or the name lookup, in milliseconds; DEFAULT_TIMEOUT (15000) is used by the short constructorsessID- must non-null if reqID >= 0h- the destination hash to look up, mutually exclusive with namename- the base32 host name to resolve through the naming service, mutually exclusive with hfromLocalDest- use these tunnels for the lookup, or null for exploratory
Method Details
getName
runJob
public void runJob()Execute the job.returnDest
Sends the destination found to the client.- Parameters:
d- the destination to return, null if none was found
returnFail
private void returnFail()Return the request ID or failed hash so the client can correlate replies with requests.returnFail
private void returnFail(int code) Return the request ID or failed hash so the client can correlate replies with requests.- Parameters:
code- failure code, greater than zero, only used for HostReplyMessage