Class DhtPktAlert

All Implemented Interfaces:
Alert<dht_pkt_alert>

public final class DhtPktAlert extends AbstractAlert<dht_pkt_alert>
This alert is posted every time a DHT message is sent or received. It is only posted if the ``alert::dht_log_notification`` alert category is enabled. It contains a verbatim copy of the message.
  • Method Details

    • pktBuf

      public byte[] pktBuf()
      Returns a copy of the packet buffer and size of the packet, respectively. This buffer is only valid for as long as the alert itself is valid, which is owned by libtorrent and reclaimed whenever pop_alerts() is called on the session.
    • direction

      public DhtPktAlert.Direction direction()
      Whether this is an incoming or outgoing packet.
      Returns:
      the direction
    • node

      public UdpEndpoint node()
      The DHT node we received this packet from, or sent this packet to (depending on direction()).
      Returns:
      the node endpoint