java.lang.Object
net.i2p.router.tunnel.OutboundMessageDistributor
When a message arrives at the outbound tunnel endpoint, this distributor honors the instructions.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classJob sending one message to the next routers.Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router context.private final LogLogger for the message distributor.private intNew routers added in the current period.private longWhen the new router period started.private final SyntheticREDQueueQueue estimating the outbound share, only for somebody else's endpoint.private final intSend priority of the distributed messages.The routers the message was already sent to.private static final longTime allowed for one distribution.private static final intMost routers sent to in one period.private static final longLength of the new router allowance period.Constructor Summary
ConstructorsConstructorDescriptionOutboundMessageDistributor(RouterContext ctx, int priority) Create a new outbound message distributor.OutboundMessageDistributor(RouterContext ctx, int priority, SyntheticREDQueue bwe) Create a new outbound message distributor with bandwidth estimation.Method Summary
Modifier and TypeMethodDescriptionvoiddistribute(I2NPMessage msg, Hash target) Warning - as of 0.9.63, msg will be an UnknownI2NPMessage, and must be converted before handling locally.voiddistribute(I2NPMessage msg, Hash target, TunnelId tunnel) Warning - as of 0.9.63, msg will be an UnknownI2NPMessage, and must be converted before handling locally.private voiddistribute(I2NPMessage msg, RouterInfo target, TunnelId tunnel) Warning - as of 0.9.63, msg will be an UnknownI2NPMessage, and must be converted before handling locally.private booleanshouldDrop(Hash target) Throttle msgs to unconnected routers after we hit the limit of new routers in a given time period.
Field Details
_context
The router context._priority
private final int _prioritySend priority of the distributed messages._log
Logger for the message distributor._toRouters
_partBWE
Queue estimating the outbound share, only for somebody else's endpoint._newRouterCount
private int _newRouterCountNew routers added in the current period._newRouterTime
private long _newRouterTimeWhen the new router period started.MAX_DISTRIBUTE_TIME
private static final long MAX_DISTRIBUTE_TIMETime allowed for one distribution.- See Also:
MAX_ROUTERS_PER_PERIOD
private static final int MAX_ROUTERS_PER_PERIODMost routers sent to in one period.NEW_ROUTER_PERIOD
private static final long NEW_ROUTER_PERIODLength of the new router allowance period.
Constructor Details
OutboundMessageDistributor
Create a new outbound message distributor.- Parameters:
ctx- our router contextpriority- OutNetMessage.PRIORITY_PARTICIPATING for somebody else's OBEP, or OutNetMessage.PRIORITY_MY_DATA for our own zero-hop OBGW/EP
OutboundMessageDistributor
Create a new outbound message distributor with bandwidth estimation.- Parameters:
ctx- our router contextpriority- OutNetMessage.PRIORITY_PARTICIPATING for somebody else's OBEP, or OutNetMessage.PRIORITY_MY_DATA for our own zero-hop OBGW/EPbwe- null for none
Method Details
distribute
Warning - as of 0.9.63, msg will be an UnknownI2NPMessage, and must be converted before handling locally.- Parameters:
msg- the message to deliver onwardtarget- the router the message is addressed to
distribute
Warning - as of 0.9.63, msg will be an UnknownI2NPMessage, and must be converted before handling locally.- Parameters:
msg- the message to deliver onwardtarget- the router the message is addressed totunnel- tunnel to wrap the message in, or null to send it bare
shouldDrop
Throttle msgs to unconnected routers after we hit the limit of new routers in a given time period.- Parameters:
target- the destination router's hash- Returns:
- true if the throttle has been exceeded and the message should be dropped, false to pass it on
distribute
Warning - as of 0.9.63, msg will be an UnknownI2NPMessage, and must be converted before handling locally.- Parameters:
msg- the message to distributetarget- the router the message is destined fortunnel- the tunnel id the message arrived on, for the reply path