java.lang.Object
net.i2p.router.tunnel.PendingGatewayMessage
net.i2p.router.tunnel.OutboundGatewayMessage
Stores all the state for an unsent or partially-sent message.
Field Summary
FieldsFields inherited from class PendingGatewayMessage
_created, _expiration, _fragmentNumber, _messageId, _offset, _remaining, _toRouter, _toTunnelModifier and TypeFieldDescriptionprotected final longWhen this message was created.protected final longThe message expiration.protected intWhich fragment we are working on.protected final longThe message ID.protected intIndex into the data to be sent.protected final byte[]Raw unfragmented message data.protected final HashThe destination router.protected final TunnelIdThe destination tunnel.Constructor Summary
ConstructorsConstructorDescriptionOutboundGatewayMessage(I2NPMessage message, Hash toRouter, TunnelId toTunnel) Caches the message priority, which the fragmenter queue orders by.Method Summary
Modifier and TypeMethodDescriptionintFor CDPQ.private static intgetPriority(I2NPMessage message) This is just for priority in the queue waiting for the fragmenter.longFor CDPQ.voidsetSeqNum(long num) For CDPQ.Methods inherited from class PendingGatewayMessage
addMessageId, drop, getData, getEnqueueTime, getExpiration, getFragmentNumber, getLifetime, getMessageId, getMessageIds, getOffset, getToRouter, getToTunnel, incrementFragmentNumber, setEnqueueTime, setOffset, toStringModifier and TypeMethodDescriptionvoidaddMessageId(long id) Add an ID to the list of the TunnelDataMssages this message was fragmented into.voiddrop()For CDQ.byte[]getData()The raw unfragmented message to send.longFor CDQ.longMessage expiration time.intWhich fragment are we working on (0 for the first fragment).longLifetime in milliseconds.longMessage ID.The IDs of the TunnelDataMssages this message was fragmented into.intThe index into the data to be sent.The destination router.The destination tunnel.voidFragment sent, so move on to the next one.voidsetEnqueueTime(long now) For CDQ.voidsetOffset(int offset) Move the offset.toString()Debug description of this pending message and its progress.
Field Details
_seqNum
private long _seqNumSequence number in the tunnel's CDP window._priority
private final int _priorityPriority level the message was sent at.
Constructor Details
OutboundGatewayMessage
Caches the message priority, which the fragmenter queue orders by.- Parameters:
message- the I2NP message to be delivered, whose priority is cached heretoRouter- the router the message is addressed totoTunnel- the tunnel the message is addressed to
Method Details
setSeqNum
getSeqNum
getPriority
public int getPriority()For CDPQ.- Specified by:
getPriorityin interfacePQEntry- Returns:
- the CDPQ priority assigned at construction
getPriority
This is just for priority in the queue waiting for the fragmenter. After the fragmenter, they will be OutNetMessages with priority 400. We use the same 100-500 priority as OutNetMessage so the stats in CoDelPriorityBlockingQueue work.We could - perhaps - have BatchedPreprocessor pass the max priority of any message fragment in a TunnelDataMessage to the OutboundReceiver, to set the OutNetMessage priority - but that may just make more of an out-of-order mess and failed reconstruction of fragments.
- Parameters:
message- the message to classify, its type selects the priority- Returns:
- the CDPQ priority for the message type, 1000 for a tagset reply down to 100 for regular data and anything unexpected