class PacketLocal extends Packet implements MessageOutputStream.WriteStatus
_nacks, _offlineSignature, _optionFrom, _optionSignature, _session, _transientExpires, _transientSigningPublicKey, DEFAULT_MAX_SIZE, FLAG_CLOSE, FLAG_DELAY_REQUESTED, FLAG_ECHO, FLAG_FROM_INCLUDED, FLAG_MAX_PACKET_SIZE_INCLUDED, FLAG_NO_ACK, FLAG_PROFILE_INTERACTIVE, FLAG_RESET, FLAG_SIGNATURE_INCLUDED, FLAG_SIGNATURE_OFFLINE, FLAG_SIGNATURE_REQUESTED, FLAG_SYNCHRONIZE, MAX_DELAY_REQUEST, MAX_PAYLOAD_SIZE, MAX_STREAM_ID, MIN_DELAY_CHOKE, SEND_DELAY_CHOKE, STREAM_ID_UNKNOWN| Constructor and Description |
|---|
PacketLocal(I2PAppContext ctx,
Destination to,
Connection con)
bound to a connection
|
PacketLocal(I2PAppContext ctx,
Destination to,
I2PSession session)
not bound to a connection
|
| Modifier and Type | Method and Description |
|---|---|
void |
ackReceived() |
void |
cancelled() |
StringBuilder |
formatAsString() |
int |
getAckTime()
how long after packet creation was it acked?
|
Connection |
getConnection() |
long |
getCreatedOn() |
long |
getLastSend() |
long |
getLifetime() |
int |
getNACKs()
Warning: This is different than getNacks() in super
|
int |
getNumSends() |
int |
getTimeout()
Used by PacketQueue to feed an expiration to the router.
|
Destination |
getTo() |
void |
incrementNACKs()
Will force a fast restransmit on the 3rd call (FAST_RETRANSMIT_THRESHOLD)
but only if it's the lowest unacked (see Connection.ResendPacketEvent)
|
void |
incrementSends() |
void |
logTCPDump()
Generate a pcap/tcpdump-compatible format,
so we can use standard debugging tools.
|
void |
setOptionalFrom()
This sets the from field in the packet to the Destination for the session
provided in the constructor.
|
void |
setTimeout(int timeout) |
boolean |
shouldSign() |
void |
waitForAccept(int maxWaitMs)
Blocks until outbound window is not full.
|
void |
waitForCompletion(int maxWaitMs)
block until the packet is acked from the far end
|
boolean |
writeAccepted()
Returns true if the write was accepted by the outbound queue.
|
boolean |
writeFailed()
Returns true if the write operation failed.
|
int |
writeSignedPacket(byte[] buffer,
int offset)
Sign and write the packet to the buffer (starting at the offset) and return
the number of bytes written.
|
boolean |
writeSuccessful()
Returns true if the write operation succeeded.
|
acquirePayload, getAckThrough, getLocalPort, getNacks, getOptionalDelay, getOptionalFrom, getOptionalMaxSize, getOptionalSignature, getPayload, getPayloadSize, getReceiveStreamId, getRemotePort, getResendDelay, getSendStreamId, getSequenceNum, getSession, getTransientSPK, isFlagSet, logTCPDump, readPacket, releasePayload, setAckThrough, setFlag, setFlag, setLocalPort, setNacks, setOptionalDelay, setOptionalMaxSize, setOptionalSignature, setPayload, setReceiveStreamId, setRemotePort, setResendDelay, setSendStreamId, setSequenceNum, toId, toString, verifySignature, verifySignature, writePacket, writePacketpublic PacketLocal(I2PAppContext ctx, Destination to, Connection con)
public PacketLocal(I2PAppContext ctx, Destination to, I2PSession session)
public void ackReceived()
public void cancelled()
public StringBuilder formatAsString()
formatAsString in class Packetpublic int getAckTime()
public Connection getConnection()
public long getCreatedOn()
public long getLastSend()
public long getLifetime()
public int getNACKs()
public int getNumSends()
public int getTimeout()
public Destination getTo()
public void incrementNACKs()
public void incrementSends()
public void logTCPDump()
public void setOptionalFrom()
public void setTimeout(int timeout)
timeout - time from now, not absolute timepublic boolean shouldSign()
public void waitForAccept(int maxWaitMs)
throws IOException,
InterruptedException
waitForAccept in interface MessageOutputStream.WriteStatusmaxWaitMs - MessageOutputStream is the only caller, generally with -1IOException - if acceptance fails or times outInterruptedException - if waiting thread is interruptedpublic void waitForCompletion(int maxWaitMs)
throws IOException,
InterruptedException
waitForCompletion in interface MessageOutputStream.WriteStatusmaxWaitMs - maximum wait time in milliseconds (-1 means wait forever)IOException - if write fails or times outInterruptedException - if waiting thread is interruptedpublic boolean writeAccepted()
MessageOutputStream.WriteStatuswriteAccepted in interface MessageOutputStream.WriteStatuspublic boolean writeFailed()
MessageOutputStream.WriteStatuswriteFailed in interface MessageOutputStream.WriteStatuspublic int writeSignedPacket(byte[] buffer,
int offset)
throws IllegalStateException
buffer - data to be writtenoffset - starting point in the bufferIllegalStateException - if there is data missing or otherwise b0rkedpublic boolean writeSuccessful()
MessageOutputStream.WriteStatuswriteSuccessful in interface MessageOutputStream.WriteStatus