java.lang.Object
net.i2p.router.tunnel.PendingGatewayMessage
- All Implemented Interfaces:
CDQEntry
- Direct Known Subclasses:
OutboundGatewayMessage
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final longWhen this message was created.private longTime enqueued in CDQ.protected final longThe message expiration.protected intWhich fragment we are working on.protected final longThe message ID.IDs of TunnelDataMessages this message was fragmented into.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
ConstructorsConstructorDescriptionPendingGatewayMessage(I2NPMessage message, Hash toRouter, TunnelId toTunnel) Stores the message data, destination, and expiration for a pending send.Method Summary
All MethodsModifier 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
_toRouter
The destination router._toTunnel
The destination tunnel._messageId
protected final long _messageIdThe message ID._expiration
protected final long _expirationThe message expiration._remaining
protected final byte[] _remainingRaw unfragmented message data._offset
protected volatile int _offsetIndex into the data to be sent._fragmentNumber
protected int _fragmentNumberWhich fragment we are working on._created
protected final long _createdWhen this message was created._messageIds
_enqueueTime
private long _enqueueTimeTime enqueued in CDQ.
Constructor Details
PendingGatewayMessage
Stores the message data, destination, and expiration for a pending send.- Parameters:
message- the I2NP message to deliver, serialized and tracked until senttoRouter- the hash of the next-hop router the message is addressed totoTunnel- the tunnel the message will be injected into at that router
Method Details
getToRouter
getToTunnel
getMessageId
public long getMessageId()Message ID.- Returns:
- the message ID
getExpiration
public long getExpiration()Message expiration time.- Returns:
- the message expiration
getData
public byte[] getData()The raw unfragmented message to send.- Returns:
- the message data
getOffset
public int getOffset()The index into the data to be sent.- Returns:
- the index of the next byte to send, 0 when the whole message is unsent
setOffset
public void setOffset(int offset) Move the offset.- Parameters:
offset- the new offset value
getLifetime
public long getLifetime()Lifetime in milliseconds.- Returns:
- the lifetime in milliseconds
getFragmentNumber
public int getFragmentNumber()Which fragment are we working on (0 for the first fragment).- Returns:
- the fragment number
incrementFragmentNumber
public void incrementFragmentNumber()Fragment sent, so move on to the next one.addMessageId
public void addMessageId(long id) Add an ID to the list of the TunnelDataMssages this message was fragmented into. Unused except in notePreprocessing() calls for debugging.- Parameters:
id- the message ID to add
getMessageIds
setEnqueueTime
public void setEnqueueTime(long now) For CDQ.- Specified by:
setEnqueueTimein interfaceCDQEntry- Parameters:
now- the enqueue timestamp
getEnqueueTime
public long getEnqueueTime()For CDQ.- Specified by:
getEnqueueTimein interfaceCDQEntry- Returns:
- the enqueue time
drop
toString