java.lang.Object
net.i2p.router.tunnel.OutboundMessageDistributor

class OutboundMessageDistributorextends Object
When a message arrives at the outbound tunnel endpoint, this distributor honors the instructions.
  • Field Details

    • _context

      private final RouterContext _context
      The router context.
    • _priority

      private final int _priority
      Send priority of the distributed messages.
    • _log

      private final Log _log
      Logger for the message distributor.
    • _toRouters

      private final Set<Hash> _toRouters
      The routers the message was already sent to.
    • _partBWE

      private final SyntheticREDQueue _partBWE
      Queue estimating the outbound share, only for somebody else's endpoint.
    • _newRouterCount

      private int _newRouterCount
      New routers added in the current period.
    • _newRouterTime

      private long _newRouterTime
      When the new router period started.
    • MAX_DISTRIBUTE_TIME

      private static final long MAX_DISTRIBUTE_TIME
      Time allowed for one distribution.
      See Also:
    • MAX_ROUTERS_PER_PERIOD

      private static final int MAX_ROUTERS_PER_PERIOD
      Most routers sent to in one period.
    • NEW_ROUTER_PERIOD

      private static final long NEW_ROUTER_PERIOD
      Length of the new router allowance period.
  • Constructor Details

    • OutboundMessageDistributor

      public OutboundMessageDistributor(RouterContext ctx, int priority)
      Create a new outbound message distributor.
      Parameters:
      ctx - our router context
      priority - OutNetMessage.PRIORITY_PARTICIPATING for somebody else's OBEP, or OutNetMessage.PRIORITY_MY_DATA for our own zero-hop OBGW/EP
    • OutboundMessageDistributor

      public OutboundMessageDistributor(RouterContext ctx, int priority, SyntheticREDQueue bwe)
      Create a new outbound message distributor with bandwidth estimation.
      Parameters:
      ctx - our router context
      priority - OutNetMessage.PRIORITY_PARTICIPATING for somebody else's OBEP, or OutNetMessage.PRIORITY_MY_DATA for our own zero-hop OBGW/EP
      bwe - null for none
  • Method Details

    • distribute

      public void distribute(I2NPMessage msg, Hash target)
      Warning - as of 0.9.63, msg will be an UnknownI2NPMessage, and must be converted before handling locally.
      Parameters:
      msg - the message to deliver onward
      target - the router the message is addressed to
    • distribute

      public void distribute(I2NPMessage msg, Hash target, TunnelId tunnel)
      Warning - as of 0.9.63, msg will be an UnknownI2NPMessage, and must be converted before handling locally.
      Parameters:
      msg - the message to deliver onward
      target - the router the message is addressed to
      tunnel - tunnel to wrap the message in, or null to send it bare
    • shouldDrop

      private boolean shouldDrop(Hash target)
      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

      private void distribute(I2NPMessage msg, RouterInfo target, TunnelId tunnel)
      Warning - as of 0.9.63, msg will be an UnknownI2NPMessage, and must be converted before handling locally.
      Parameters:
      msg - the message to distribute
      target - the router the message is destined for
      tunnel - the tunnel id the message arrived on, for the reply path