net.i2p.router.transport.udp

## Class PacketHandler

- java.lang.Object
- - net.i2p.router.transport.udp.PacketHandler

-     class PacketHandler
      extends Object

  Pull inbound packets from the inbound receiver's queue, figure out what peer session they belong to (if any), authenticate and decrypt them with the appropriate keys, and push them to the appropriate handler. Data and ACK packets go to the InboundMessageFragments, the various establishment packets go to the EstablishmentManager, and, once implemented, relay packets will go to the relay manager. At the moment, this is an actual pool of packet handler threads, each pulling off the inbound receiver's queue and pushing them as necessary.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PacketHandler(RouterContext ctx, UDPTransport transport, EstablishmentManager establisher, InboundMessageFragments inbound, PeerTestManager testManager, IntroductionManager introManager)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) String` | `getHandlerStatus()`
    `(package private) boolean` | `isBacklogged()` Check if the inbound queue is backlogged (near capacity or high delay).
    `void` | `queueReceived(UDPPacket packet)` Blocking call to retrieve the next inbound packet, or null if we have shut down.
    `UDPPacket` | `receiveNext()` Blocking call to retrieve the next inbound packet, or null if we have shut down.
    `void` | `shutdown()`
    `void` | `startup()`

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

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

- - ### Constructor Detail

    - #### PacketHandler

          PacketHandler(RouterContext ctx,
                        UDPTransport transport,
                        EstablishmentManager establisher,
                        InboundMessageFragments inbound,
                        PeerTestManager testManager,
                        IntroductionManager introManager)

  - ### Method Detail

    - #### getHandlerStatus

          String getHandlerStatus()

    - #### isBacklogged

          boolean isBacklogged()

      Check if the inbound queue is backlogged (near capacity or high delay). Used by UDPReceiver to drop packets early before queueing.
      Returns:
        true if queue is backlogged

    - #### queueReceived

          public void queueReceived(UDPPacket packet)
                             throws InterruptedException

      Blocking call to retrieve the next inbound packet, or null if we have shut down.
      Throws:
        `InterruptedException`

    - #### receiveNext

          public UDPPacket receiveNext()

      Blocking call to retrieve the next inbound packet, or null if we have shut down.

    - #### shutdown

          public void shutdown()

    - #### startup

          public void startup()