java.lang.Object
net.i2p.router.tunnel.PendingGatewayMessage
net.i2p.router.tunnel.OutboundGatewayMessage
All Implemented Interfaces:
CDPQEntry, CDQEntry, PQEntry

class OutboundGatewayMessageextends PendingGatewayMessage implements CDPQEntry
Stores all the state for an unsent or partially-sent message.
  • Field Details

    • _seqNum

      private long _seqNum
      Sequence number in the tunnel's CDP window.
    • _priority

      private final int _priority
      Priority level the message was sent at.
  • Constructor Details

    • OutboundGatewayMessage

      public OutboundGatewayMessage(I2NPMessage message, Hash toRouter, TunnelId toTunnel)
      Caches the message priority, which the fragmenter queue orders by.
      Parameters:
      message - the I2NP message to be delivered, whose priority is cached here
      toRouter - the router the message is addressed to
      toTunnel - the tunnel the message is addressed to
  • Method Details

    • setSeqNum

      public void setSeqNum(long num)
      For CDPQ.
      Specified by:
      setSeqNum in interface PQEntry
      Parameters:
      num - the sequence number
    • getSeqNum

      public long getSeqNum()
      For CDPQ.
      Specified by:
      getSeqNum in interface PQEntry
      Returns:
      the seq num
    • getPriority

      public int getPriority()
      For CDPQ.
      Specified by:
      getPriority in interface PQEntry
      Returns:
      the CDPQ priority assigned at construction
    • getPriority

      private static int getPriority(I2NPMessage message)
      This is just for priority in the queue waiting for the fragmenter. After the fragmenter, they will be OutNetMessages with priority 400. We use the same 100-500 priority as OutNetMessage so the stats in CoDelPriorityBlockingQueue work.

      We could - perhaps - have BatchedPreprocessor pass the max priority of any message fragment in a TunnelDataMessage to the OutboundReceiver, to set the OutNetMessage priority - but that may just make more of an out-of-order mess and failed reconstruction of fragments.

      Parameters:
      message - the message to classify, its type selects the priority
      Returns:
      the CDPQ priority for the message type, 1000 for a tagset reply down to 100 for regular data and anything unexpected