net.i2p.client.streaming.impl

## Class PacketHandler

- java.lang.Object
- - net.i2p.client.streaming.impl.PacketHandler

-     class PacketHandler
      extends Object

  Handles incoming packets by dispatching them to the appropriate connection, server socket, or responding with a reset (RST) packet if no valid connection is found.

  Packet flow: I2PSession -> MessageHandler -> PacketHandler -> ConnectionPacketHandler -> MessageInputStream.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PacketHandler(I2PAppContext ctx, ConnectionManager mgr)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) void` | `displayPacket(Packet packet, String prefix, String suffix)` Logs the provided packet at debug level with a timestamp.
    `(package private) void` | `receivePacket(Packet packet)` Receives a packet and dispatches it to the appropriate handler.
    `(package private) void` | `receivePacketDirect(Packet packet, boolean queueIfNoConn)` Processes the packet immediately, optionally queuing if no connection is found.

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

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

- - ### Constructor Detail

    - #### PacketHandler

          public PacketHandler(I2PAppContext ctx,
                               ConnectionManager mgr)

  - ### Method Detail

    - #### displayPacket

          void displayPacket(Packet packet,
                             String prefix,
                             String suffix)

      Logs the provided packet at debug level with a timestamp.
      Parameters:
        `packet` - the packet to log
        `prefix` - text prefix (e.g., "RECV" or "UNKN")
        `suffix` - additional info appended after the packet string, may be null

    - #### receivePacket

          void receivePacket(Packet packet)

      Receives a packet and dispatches it to the appropriate handler.
      Parameters:
        `packet` - the packet to process

    - #### receivePacketDirect

          void receivePacketDirect(Packet packet,
                                   boolean queueIfNoConn)

      Processes the packet immediately, optionally queuing if no connection is found.
      Parameters:
        `packet` - the packet to process
        `queueIfNoConn` - queue the packet if no matching connection exists