Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.i2p.router.transport.udp
Class OutboundMessageState

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

     class OutboundMessageState

extends Object

Maintain the outbound fragmentation for resending

Field Summary
`static int` | `MAX_MSG_SIZE`

Constructor Summary
`OutboundMessageState(I2PAppContext context)`

Method Summary
`boolean` | `acked(ACKBitfield bitfield)` Ack all the fragments in the ack list.
`void` | `fragment(int fragmentSize)` Prepare the message for fragmented delivery, using no more than fragmentSize bytes per fragment.
`int` | `fragmentSize(int fragmentNum)`
`int` | `getFragmentCount()` how many fragments in the message
`int` | `getFragmentSize()`
`long` | `getLifetime()`
`int` | `getMaxSends()`
`OutNetMessage` | `getMessage()`
`long` | `getMessageId()`
`long` | `getNextSendTime()`
`PeerState` | `getPeer()`
`int` | `getPushCount()`
`int` | `getUnackedSize()`
`boolean` | `initialize(I2NPMessage msg, PeerState peer)`
`boolean` | `initialize(OutNetMessage msg)`
`boolean` | `initialize(OutNetMessage m, I2NPMessage msg)`
`boolean` | `isComplete()`
`boolean` | `isExpired()`
`boolean` | `isFragmented()`
`boolean` | `needsSending(int fragment)`
`void` | `push()` note that we have pushed the message fragments
`void` | `releaseResources()` This is synchronized with writeFragment(), so we do not release (probably due to an ack) while we are retransmitting.
`void` | `setNextSendTime(long when)`
`void` | `setPeer(PeerState peer)`
`boolean` | `shouldSend(int fragmentNum)` should we continue sending this fragment?
`String` | `toString()`
`int` | `writeFragment(byte[] out, int outOffset, int fragmentNum)` Write a part of the the message onto the specified buffer.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### MAX_MSG_SIZE

    public static final int MAX_MSG_SIZE

See Also:
  Constant Field Values

Constructor Detail

### OutboundMessageState

    public OutboundMessageState(I2PAppContext context)

Method Detail

### initialize

    public boolean initialize(OutNetMessage msg)

### initialize

    public boolean initialize(I2NPMessage msg,
                              PeerState peer)

### initialize

    public boolean initialize(OutNetMessage m,
                              I2NPMessage msg)

### releaseResources

    public void releaseResources()

  This is synchronized with writeFragment(), so we do not release (probably due to an ack) while we are retransmitting. Also prevent double-free

### getMessage

    public OutNetMessage getMessage()

### getMessageId

    public long getMessageId()

### getPeer

    public PeerState getPeer()

### setPeer

    public void setPeer(PeerState peer)

### isExpired

    public boolean isExpired()

### isComplete

    public boolean isComplete()

### getUnackedSize

    public int getUnackedSize()

### needsSending

    public boolean needsSending(int fragment)

### getLifetime

    public long getLifetime()

### acked

    public boolean acked(ACKBitfield bitfield)

  Ack all the fragments in the ack list. As a side effect, if there are still unacked fragments, the 'next send' time will be updated under the assumption that that all of the packets within a volley would reach the peer within that ack frequency (2-400ms).

  Returns:
    true if the message was completely ACKed

### getNextSendTime

    public long getNextSendTime()

### setNextSendTime

    public void setNextSendTime(long when)

### getMaxSends

    public int getMaxSends()

### getPushCount

    public int getPushCount()

### push

    public void push()

  note that we have pushed the message fragments

### isFragmented

    public boolean isFragmented()

### fragment

    public void fragment(int fragmentSize)

  Prepare the message for fragmented delivery, using no more than fragmentSize bytes per fragment.

### getFragmentCount

    public int getFragmentCount()

  how many fragments in the message

### getFragmentSize

    public int getFragmentSize()

### shouldSend

    public boolean shouldSend(int fragmentNum)

  should we continue sending this fragment?

### fragmentSize

    public int fragmentSize(int fragmentNum)

### writeFragment

    public int writeFragment(byte[] out,
                             int outOffset,
                             int fragmentNum)

  Write a part of the the message onto the specified buffer. See releaseResources() above for synchhronization information.

  Parameters:
    `out` - target to write
    `outOffset` - into outOffset to begin writing
    `fragmentNum` - fragment to write (0 indexed)
  Returns:
    bytesWritten

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD