java.lang.Object
net.i2p.router.message.GarlicMessageHandler
- All Implemented Interfaces:
HandlerJobBuilder
Builds jobs to process garlic messages received outside tunnels. Handles floodfill netdb operations and garlic routing for direct peer communications.
This is the handler for garlic message not received down a tunnel, which is the case for floodfills receiving netdb messages. It is not the handler for garlic messages received down a tunnel, as InNetMessagePool short circuits tunnel messages, and those garlic messages are handled in InboundMessageDistributor.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router handling the message.private final longXor mask for this router's own message ids.private final longXor mask for messages from other routers.private final longXor mask for messages arriving through a tunnel.Constructor Summary
ConstructorsConstructorDescriptionGarlicMessageHandler(RouterContext context) Create a handler that draws a fresh random message-ID XOR mask for each of the local, router and tunnel scopes.GarlicMessageHandler(RouterContext context, long msgIDBloomXorLocal, long msgIDBloomXorRouter, long msgIDBloomXorTunnel) Create a handler using fixed message-ID XOR masks, so the bloom filters can be primed identically across restarts.Method Summary
All MethodsModifier and TypeMethodDescriptioncreateJob(I2NPMessage receivedMessage, RouterIdentity from, Hash fromHash) Create and return a job to handle this message.
Field Details
_context
The router handling the message._msgIDBloomXorLocal
private final long _msgIDBloomXorLocalXor mask for this router's own message ids._msgIDBloomXorRouter
private final long _msgIDBloomXorRouterXor mask for messages from other routers._msgIDBloomXorTunnel
private final long _msgIDBloomXorTunnelXor mask for messages arriving through a tunnel.
Constructor Details
GarlicMessageHandler
Create a handler that draws a fresh random message-ID XOR mask for each of the local, router and tunnel scopes.- Parameters:
context- the router context the built jobs run against
GarlicMessageHandler
public GarlicMessageHandler(RouterContext context, long msgIDBloomXorLocal, long msgIDBloomXorRouter, long msgIDBloomXorTunnel) Create a handler using fixed message-ID XOR masks, so the bloom filters can be primed identically across restarts.- Parameters:
context- the router context the built jobs run againstmsgIDBloomXorLocal- mask applied to message IDs in the local scopemsgIDBloomXorRouter- mask applied to message IDs in the router scopemsgIDBloomXorTunnel- mask applied to message IDs in the tunnel scope
Method Details
createJob
Create and return a job to handle this message.- Specified by:
createJobin interfaceHandlerJobBuilder- Parameters:
receivedMessage- I2NP message receivedfrom- router that sent the message (if available)fromHash- hash of the routerIdentity of the router that sent the message (if available)- Returns:
- a job or null if no particular job is appropriate (in which case, the message should go into the inbound message pool)