|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.tunnel.TrivialPreprocessor
class TrivialPreprocessor
Do the simplest thing possible for preprocessing - for each message available, turn it into the minimum number of fragmented preprocessed blocks, sending each of those out. This does not coallesce message fragments or delay for more optimal throughput. See FragmentHandler Javadoc for tunnel message fragment format
Field Summary | |
---|---|
protected RouterContext |
_context
|
protected static ByteCache |
_dataCache
Here in tunnels, we take from the cache but never add to it. |
protected Log |
_log
|
protected static int |
IV_SIZE
|
static int |
PREPROCESSED_SIZE
|
Constructor Summary | |
---|---|
TrivialPreprocessor(RouterContext ctx)
|
Method Summary | |
---|---|
long |
getDelayAmount()
how long do we want to wait before flushing |
protected int |
getInstructionAugmentationSize(PendingGatewayMessage msg,
int offset,
int instructionsSize)
|
protected int |
getInstructionsSize(PendingGatewayMessage msg)
|
protected void |
notePreprocessing(long messageId,
int numFragments,
int totalLength,
List<Long> messageIds,
String msg)
|
protected void |
preprocess(byte[] fragments,
int fragmentLength)
Wrap the preprocessed fragments with the necessary padding / checksums to act as a tunnel message. |
boolean |
preprocessQueue(List<PendingGatewayMessage> pending,
TunnelGateway.Sender sender,
TunnelGateway.Receiver rec)
Return true if there were messages remaining, and we should queue up a delayed flush to clear them NOTE: Unused here, see BatchedPreprocessor override, super is not called. |
protected int |
writeFirstFragment(PendingGatewayMessage msg,
byte[] target,
int offset)
|
protected int |
writeSubsequentFragment(PendingGatewayMessage msg,
byte[] target,
int offset)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final RouterContext _context
protected final Log _log
public static final int PREPROCESSED_SIZE
protected static final int IV_SIZE
protected static final ByteCache _dataCache
Constructor Detail |
---|
public TrivialPreprocessor(RouterContext ctx)
Method Detail |
---|
public long getDelayAmount()
getDelayAmount
in interface TunnelGateway.QueuePreprocessor
public boolean preprocessQueue(List<PendingGatewayMessage> pending, TunnelGateway.Sender sender, TunnelGateway.Receiver rec)
preprocessQueue
in interface TunnelGateway.QueuePreprocessor
pending
- list of Pending objects for messages either unsent
or partly sent. This list should be update with any
values removed (the preprocessor owns the lock)
Messages are not removed from the list until actually sent.
The status of unsent and partially-sent messages is stored in
the Pending structure.
protected void notePreprocessing(long messageId, int numFragments, int totalLength, List<Long> messageIds, String msg)
protected void preprocess(byte[] fragments, int fragmentLength)
fragmentLength
- fragments[0:fragmentLength] is usedprotected int writeFirstFragment(PendingGatewayMessage msg, byte[] target, int offset)
protected int writeSubsequentFragment(PendingGatewayMessage msg, byte[] target, int offset)
protected int getInstructionsSize(PendingGatewayMessage msg)
protected int getInstructionAugmentationSize(PendingGatewayMessage msg, int offset, int instructionsSize)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |