net.i2p.router.transport.udp
Class OutboundMessageFragments

java.lang.Object
  extended bynet.i2p.router.transport.udp.OutboundMessageFragments

public class OutboundMessageFragments
extends java.lang.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 getNextPacket(). 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.


Constructor Summary
OutboundMessageFragments(RouterContext ctx, UDPTransport transport)
           
 
Method Summary
 int acked(long messageId, Hash ackedBy)
          We received an ACK of the given messageId from the given peer, so if it is still unacked, mark it as complete.
 void acked(long messageId, int[] ackedFragments, Hash ackedBy)
          Receive a set of fragment ACKs for a given messageId from the specified peer
 void add(OutboundMessageState state)
          short circuit the OutNetMessage, letting us send the establish complete message reliably
 void add(OutNetMessage msg)
          Add a new message to the active pool
 UDPPacket getNextPacket()
          Grab the next packet that we want to send, blocking until one is ready.
 void shutdown()
           
 void startup()
           
 boolean waitForMoreAllowed()
          Block until we allow more messages to be admitted to the active pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutboundMessageFragments

public OutboundMessageFragments(RouterContext ctx,
                                UDPTransport transport)
Method Detail

startup

public void startup()

shutdown

public void shutdown()

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)
short circuit the OutNetMessage, letting us send the establish complete message reliably


getNextPacket

public UDPPacket getNextPacket()
Grab the next packet that we want to send, blocking until one is ready. This is the main driver for the packet scheduler


acked

public int acked(long messageId,
                 Hash ackedBy)
We received an ACK of the given messageId from the given peer, so if it is still unacked, mark it as complete.

Returns:
fragments acked

acked

public void acked(long messageId,
                  int[] ackedFragments,
                  Hash ackedBy)
Receive a set of fragment ACKs for a given messageId from the specified peer