Package net.i2p.router.tunnel
Class FragmentedMessage
java.lang.Object
net.i2p.router.tunnel.FragmentedMessage
Gather fragments of I2NPMessages at a tunnel endpoint, making them available
for reading when complete.
Warning - this is all unsynchronized here - receivers must implement synchronization
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
failed()
int
used in the fragment handler so we can cancel the expire event on successint
long
how long has this fragmented message been alive?long
boolean
long
boolean
have we received all of the fragments?boolean
Receive the first fragment (#0) and related metadata.boolean
receive
(int fragmentNum, byte[] payload, int offset, int length, boolean isLast) Receive a followup fragment, though one of these may arrive at the endpoint prior to the fragment # 0.void
byte[]
toString()
toString
-
Constructor Details
-
FragmentedMessage
-
-
Method Details
-
receive
public boolean receive(int fragmentNum, byte[] payload, int offset, int length, boolean isLast) Receive a followup fragment, though one of these may arrive at the endpoint prior to the fragment # 0.- Parameters:
fragmentNum
- sequence number within the message (1 - 63)payload
- data for the fragment non-nulloffset
- index into the payload where the fragment data starts (past headers/etc)length
- how much past the offset should we snag?isLast
- is this the last fragment in the message?
-
receive
public boolean receive(byte[] payload, int offset, int length, boolean isLast, Hash toRouter, TunnelId toTunnel) Receive the first fragment (#0) and related metadata. This may not be the first one to arrive at the endpoint however.- Parameters:
payload
- data for the fragment non-nulloffset
- index into the payload where the fragment data starts (past headers/etc)length
- how much past the offset should we snag?isLast
- is this the last fragment in the message?toRouter
- what router is this destined for (may be null)toTunnel
- what tunnel is this destined for (may be null)
-
getMessageId
public long getMessageId() -
getTargetRouter
-
getTargetTunnel
-
getFragmentCount
public int getFragmentCount() -
getExpireEvent
used in the fragment handler so we can cancel the expire event on success -
setExpireEvent
-
isComplete
public boolean isComplete()have we received all of the fragments? -
getCompleteSize
public int getCompleteSize() -
getLifetime
public long getLifetime()how long has this fragmented message been alive? -
getReleased
public boolean getReleased() -
toByteArray
public byte[] toByteArray() -
getReleasedAfter
public long getReleasedAfter() -
failed
public void failed() -
toString
toString
-