java.lang.Object
net.i2p.router.tunnel.OutboundReceiver
- All Implemented Interfaces:
TunnelGateway.Receiver
We are the outbound gateway - we created this outbound tunnel. Receive the outbound message after it has been preprocessed and encrypted, then forward it on to the first hop in the tunnel.
Not used for zero-hop OBGWs.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classImmediately fail the tunnel if the lookup fails.private classImmediately fail the tunnel if the send fails.private classJob sending one message to the next hop.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final TunnelCreatorConfigThe tunnel the messages go through.private final RouterContextThe router context.private final LogLogger for the outbound receiver.private RouterInfoThe cached next hop router info.private final intSend priority of the tunnel messages.private final JobImplThe same job instance run after any failed send.private static final longTime allowed for the next hop lookup.private static final intSend priority of our own tunnel messages.Constructor Summary
ConstructorsConstructorDescriptionOutboundReceiver(RouterContext ctx, TunnelCreatorConfig cfg) Binds the context and tunnel config, caching the first hop router info.Method Summary
Modifier and TypeMethodDescriptionThe next hop.longreceiveEncrypted(byte[] encrypted) Forward the encrypted data to the first hop in the tunnel.private voidsend(TunnelDataMessage msg, RouterInfo ri) Queues the message for sending to the next hop.
Field Details
_context
The router context._log
Logger for the outbound receiver._config
The tunnel the messages go through._nextHopCache
The cached next hop router info._priority
private final int _prioritySend priority of the tunnel messages._sendFailJob
The same job instance run after any failed send.MAX_LOOKUP_TIME
private static final long MAX_LOOKUP_TIMETime allowed for the next hop lookup.- See Also:
PRIORITY
private static final int PRIORITYSend priority of our own tunnel messages.- See Also:
Constructor Details
OutboundReceiver
Binds the context and tunnel config, caching the first hop router info.- Parameters:
ctx- router context, used for the log, the netdb lookup and the failure jobcfg- tunnel configuration supplying the first hop, priority and send tunnel
Method Details
receiveEncrypted
public long receiveEncrypted(byte[] encrypted) Forward the encrypted data to the first hop in the tunnel.- Specified by:
receiveEncryptedin interfaceTunnelGateway.Receiver- Parameters:
encrypted- the encrypted data- Returns:
- message ID it was sent in, or -1 if it had to be deferred
getSendTo
The next hop.- Specified by:
getSendToin interfaceTunnelGateway.Receiver- Returns:
- non-null
send
Queues the message for sending to the next hop.- Parameters:
msg- the message to sendri- the next hop's router info