Modifier and Type | Field and Description |
---|---|
static int |
MAX_MSG_SIZE |
Constructor and Description |
---|
OutboundMessageState(I2PAppContext context,
I2NPMessage msg,
PeerState peer)
Called from UDPTransport
|
OutboundMessageState(I2PAppContext context,
OutNetMessage m,
PeerState peer)
Called from OutboundMessageFragments
|
Modifier and Type | Method and Description |
---|---|
boolean |
acked(ACKBitfield bitfield)
Ack all the fragments in the ack list.
|
void |
drop()
For CDQ
|
void |
fragment(int fragmentSize)
Prepare the message for fragmented delivery, using no more than
fragmentSize bytes per fragment.
|
int |
fragmentSize(int fragmentNum)
This assumes fragment(int size) has been called
|
long |
getEnqueueTime()
For CDQ
|
int |
getFragmentCount()
How many fragments in the message.
|
long |
getLifetime() |
int |
getMaxSends()
The max number of sends for any fragment, which is the
same as the push count, at least as it's coded now.
|
OutNetMessage |
getMessage() |
long |
getMessageId() |
int |
getMessageSize()
The size of the I2NP message.
|
long |
getNextSendTime() |
PeerState |
getPeer() |
int |
getPriority()
For CDPQ
|
int |
getPushCount()
The number of times we've pushed some fragments, which is the
same as the max sends, at least as it's coded now.
|
long |
getSeqNum()
For CDPQ
|
int |
getUnackedSize() |
boolean |
isComplete() |
boolean |
isExpired() |
boolean |
isFragmented()
Whether fragment() has been called.
|
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 |
setEnqueueTime(long now)
For CDQ
|
void |
setNextSendTime(long when) |
void |
setSeqNum(long num)
For CDPQ
|
boolean |
shouldSend(int fragmentNum)
Should we continue sending this fragment?
Only valid after fragment() has been called.
|
String |
toString() |
int |
writeFragment(byte[] out,
int outOffset,
int fragmentNum)
Write a part of the the message onto the specified buffer.
|
public static final int MAX_MSG_SIZE
public OutboundMessageState(I2PAppContext context, I2NPMessage msg, PeerState peer)
IAE
- if too big or if msg or peer is nullpublic OutboundMessageState(I2PAppContext context, OutNetMessage m, PeerState peer)
IAE
- if too big or if msg or peer is nullpublic void releaseResources()
public OutNetMessage getMessage()
public long getMessageId()
public PeerState getPeer()
public boolean isExpired()
public boolean isComplete()
public int getUnackedSize()
public boolean needsSending(int fragment)
public long getLifetime()
public boolean acked(ACKBitfield bitfield)
public long getNextSendTime()
public void setNextSendTime(long when)
public int getMaxSends()
public int getPushCount()
public void push()
public boolean isFragmented()
public void fragment(int fragmentSize)
IllegalStateException
- if called more than oncepublic int getFragmentCount()
public int getMessageSize()
public boolean shouldSend(int fragmentNum)
public int fragmentSize(int fragmentNum)
fragmentNum
- the number of the fragmentpublic int writeFragment(byte[] out, int outOffset, int fragmentNum)
out
- target to writeoutOffset
- into outOffset to begin writingfragmentNum
- fragment to write (0 indexed)public void setEnqueueTime(long now)
setEnqueueTime
in interface CDQEntry
public long getEnqueueTime()
getEnqueueTime
in interface CDQEntry
public void setSeqNum(long num)
public long getSeqNum()
public int getPriority()
getPriority
in interface PQEntry