net.i2p.router.tunnel

## Class ThrottledPumpedTunnelGateway

- java.lang.Object
- - net.i2p.router.tunnel.TunnelGateway
  - - net.i2p.router.tunnel.PumpedTunnelGateway
    - - net.i2p.router.tunnel.ThrottledPumpedTunnelGateway

-     public class ThrottledPumpedTunnelGateway
      extends PumpedTunnelGateway

  Same as PTG, but check to see if a message should be dropped before queueing it. Used for IBGWs.
  Since:
    0.7.9

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.i2p.router.tunnel.TunnelGateway

      `TunnelGateway.Pending, TunnelGateway.PendingImpl, TunnelGateway.QueuePreprocessor, TunnelGateway.Receiver, TunnelGateway.Sender`

  - ### Field Summary

    - ### Fields inherited from class net.i2p.router.tunnel.TunnelGateway

      `_context, _delayedFlush, _flushFrequency, _lastFlush, _log, _messagesSent, _preprocessor, _queue, _receiver, _sender`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ThrottledPumpedTunnelGateway(RouterContext context, TunnelGateway.QueuePreprocessor preprocessor, TunnelGateway.Sender sender, TunnelGateway.Receiver receiver, TunnelGatewayPumper pumper, HopConfig config)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(I2NPMessage msg, Hash toRouter, TunnelId toTunnel)` Possibly drop a message due to bandwidth before adding it to the preprocessor queue.

    - ### Methods inherited from class net.i2p.router.tunnel.PumpedTunnelGateway

      `pump`

    - ### Methods inherited from class net.i2p.router.tunnel.TunnelGateway

      `add, getMessagesSent`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ThrottledPumpedTunnelGateway

          public ThrottledPumpedTunnelGateway(RouterContext context,
                                      TunnelGateway.QueuePreprocessor preprocessor,
                                      TunnelGateway.Sender sender,
                                      TunnelGateway.Receiver receiver,
                                      TunnelGatewayPumper pumper,
                                      HopConfig config)

  - ### Method Detail

    - #### add

          public void add(I2NPMessage msg,
                 Hash toRouter,
                 TunnelId toTunnel)

      Possibly drop a message due to bandwidth before adding it to the preprocessor queue. We do this here instead of in the InboundGatewayReceiver because it is much smarter to drop whole I2NP messages, where we know the message type and length, rather than tunnel messages containing I2NP fragments.
      Overrides:
        `add` in class `PumpedTunnelGateway`
      Parameters:
        `msg` - message to be sent through the tunnel
        `toRouter` - router to send to after the endpoint (or null for endpoint processing)
        `toTunnel` - tunnel to send to after the endpoint (or null for endpoint or router processing)