Class OutboundMessageFragments

java.lang.Object
net.i2p.router.transport.udp.OutboundMessageFragments

class OutboundMessageFragments
extends Object
Coordinate the outbound fragments and select the next one to be built. This pool contains messages we are actively trying to send, essentially doing a round robin across each message to send one fragment, as implemented in getNextVolley(). This also honors per-peer throttling, taking note of each peer's allocations. If a message has each of its fragments sent more than a certain number of times, it is failed out. In addition, this instance also receives notification of message ACKs from the InboundMessageFragments, signaling that we can stop sending a message.
  • Field Details

  • Constructor Details

  • Method Details

    • startup

      public void startup()
    • shutdown

      public void shutdown()
    • dropPeer

      void dropPeer​(PeerState peer)
    • waitForMoreAllowed

      public boolean waitForMoreAllowed()
      Block until we allow more messages to be admitted to the active pool. This is called by the OutboundRefiller
      Returns:
      true if more messages are allowed
    • add

      public void add​(OutNetMessage msg)
      Add a new message to the active pool
    • add

      public void add​(OutboundMessageState state, PeerState peer)
      Short circuit the OutNetMessage, letting us send the establish complete message reliably. If you have multiple messages, use the list variant, so the messages may be bundled efficiently.
    • add

      public void add​(List<OutboundMessageState> states, PeerState peer)
      Short circuit the OutNetMessage, letting us send multiple messages reliably and efficiently.
      Since:
      0.9.24
    • add

      public void add​(PeerState peer, int size)
      Add the peer to the list of peers wanting to transmit something. This wakes up the packet pusher if it is sleeping. Avoid synchronization where possible. There are small chances of races. There are larger chances of adding the PeerState "behind" where the iterator is now... but these issues are the same as before concurrentification.
      Parameters:
      size - the minimum size we can send, or 0 to always notify
      Since:
      0.8.9
    • getNextVolley

      public List<UDPPacket> getNextVolley()
      Fetch all the packets for a message volley, blocking until there is a message which can be fully transmitted (or the transport is shut down). NOT thread-safe. Called by the PacketPusher thread only.
      Returns:
      null only on shutdown
    • nudge

      void nudge()
      Wakes up the packet pusher thread.
      Since:
      0.9.48