Modifier and Type | Field and Description |
---|---|
static int |
MAX_FRAGMENTS |
static int |
MAX_PARTIAL_BITFIELD_BYTES
10
|
Constructor and Description |
---|
InboundMessageState(RouterContext ctx,
long messageId,
Hash from)
Only for Poison right now.
|
InboundMessageState(RouterContext ctx,
long messageId,
Hash from,
byte[] data,
int off,
int len,
int fragmentNum,
boolean isLast)
Create a new IMS and read in the data from the fragment.
|
Modifier and Type | Method and Description |
---|---|
ACKBitfield |
createACKBitfield()
Only call this if not complete.
|
void |
drop()
For CDQ
|
int |
getCompleteSize() |
long |
getEnqueueTime()
For CDQ
|
int |
getFragmentCount() |
ByteArray[] |
getFragments() |
Hash |
getFrom() |
long |
getLifetime() |
long |
getMessageId() |
boolean |
hasFragment(int fragmentNum)
Do we have this fragment?
SSU 2 only.
|
boolean |
isComplete()
May not be valid after released.
|
boolean |
isExpired() |
boolean |
receiveFragment(byte[] data,
int off,
int len,
int fragmentNum,
boolean isLast)
Read in the data from the fragment.
|
void |
releaseResources() |
void |
setEnqueueTime(long now)
For CDQ
|
String |
toString()
May not be valid if released, or may NPE on race with release, use with care in exception text
|
public static final int MAX_FRAGMENTS
public static final int MAX_PARTIAL_BITFIELD_BYTES
public InboundMessageState(RouterContext ctx, long messageId, Hash from)
public InboundMessageState(RouterContext ctx, long messageId, Hash from, byte[] data, int off, int len, int fragmentNum, boolean isLast) throws DataFormatException
fragmentNum
- the fragment numberDataFormatException
- if the fragment was corruptpublic boolean receiveFragment(byte[] data, int off, int len, int fragmentNum, boolean isLast) throws DataFormatException
fragmentNum
- the fragment numberDataFormatException
public boolean hasFragment(int fragmentNum)
fragmentNum
- the fragment numberpublic boolean isComplete()
public boolean isExpired()
public long getLifetime()
public void setEnqueueTime(long now)
setEnqueueTime
in interface CDQEntry
public long getEnqueueTime()
getEnqueueTime
in interface CDQEntry
public Hash getFrom()
public long getMessageId()
public int getCompleteSize()
IllegalStateException
- if released or not isComplete()public ACKBitfield createACKBitfield()
public void releaseResources()
public ByteArray[] getFragments()
IllegalStateException
- if releasedpublic int getFragmentCount()