- All Implemented Interfaces:
I2PSocketOptions
Static fields with volatile and class-level setters (e.g., setInitialRTO(int), setMaxWindowSize(int)) are globally shared and adjusted by the Tuner. Per-connection fields are copied from these globals when a new Connection is created.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enumRTT initialization state machine.Field Summary
Modifier and TypeFieldDescriptionAccess list.private booleanAccess list enabled.private intAck delay.private booleanAnswer pings.Black list.private booleanBlack list enabled.private intCongestion avoidance growth rate factor.private intConnect delay.private booleanDisable reject log.private booleanFully signed.private intInactivity action.private intInactivity timeout.private intInbound buffer size.private longPrevents RTO overshoot from rapid RetransmitEvent + ResendPacketEvent double-fires.private StringLimit action.private longMax connect timeout override in ms, 0 = use globali2p.streaming.maxConnectTimeout.private intMax conns.private intMax conns per day.private intMax conns per hour.private intMax conns per minute.private intMax initial message size.private intMax message size.private intHybrid byte+packet buffer limit; default 1024 for optimal performance.private intMax resends.private intMax total conns per day.private intMax total conns per hour.private intMax total conns per minute.private intMax window size.private intMin rtt.(package private) java.util.function.LongSupplierNanosecond time source for the RTO-doubling gap.private intPer-connection passive flush delay; <= 0 means use Tuner-managed global default.private intConnection traffic profile (only bulk supported).private intRetransmit delay.private intRetransmit timeout.private intRtt deviation.private ConnectionOptions.RttStateSynchronizes access to the RTT state.private intSlow start growth rate factor.private intSmoothed rtt.private longWall-clock ms an established connection may hold an unacked packet; see PROP_STALL_GIVEUP_MS.private intTags to send.private intTag threshold.private intWindow size.(package private) static intAccept worker threads, Tuner-managed override; 0 = no override.private static final booleanDefault answer pings.private static final intDefault inactivity action.static final intInitial RTT estimate before first measurement.private static final StringAction taken when connections exceed a limit; one of "reset", "drop", "http" @since 0.9.34.static final intDefault maximum streaming message payload size, derived from 2 tunnel messages.static final intOverride max message size for ratcheted connections per proposal 144 @since 0.9.47.(package private) static final intDefault maximum number of times a single message will be retransmitted.(package private) static final longDefault wall-clock budget for giving up on forward progress.static final intTag count below which the session is considered tag-short; default 30 @since 0.9.34.static final intElGamal tags sent up front before blocking on tag generation; default 40 @since 0.9.34.private static intDivisor the linear congestion-avoidance growth uses, so the window gains roughly 1/N messages per RTT; 1 is the slowest (1 per RTT).(package private) static intIdle time before the inactivity action fires; default 300s @since 0.9.70+ mutable for adaptive tuning.private static int500ms provides a reasonable delayed-ACK window for I2P's high-latency, allowing data piggybacking and reducing ACK-only packet floods.private static intDefault initial RTO (ms) before any RTT measurement.private static intDelay before the first retransmit of a packet, in ms; the fallback forPROP_INITIAL_RESEND_DELAYwhen that property is absent.private static intDivisor the slow-start growth uses, so the window gains roughly acked/N messages per ACK; 1 is the fastest (a full acked per ACK).private static intImmediate ack delay.static final intDisconnect the connection when inactivity timeout fires.static final intNo action taken when inactivity timeout fires.static final intSend a keepalive when inactivity timeout fires.(package private) static intRFC 6928 recommends 10; raised to 64 in 0.9.48 for I2P's high-latency environment and to 128 for the 0.9.71+ fast-ramp profile: each stream starts with up to 128 messages in flight, so the first RTT on a high-bandwidth path is not spent proving link capacity.(package private) static intReactive cap on concurrent streams (both per-manager inbound budget and the outbound wait queue), written by the router's Tuner under saturation.private static intMaximum inbound buffer cap, tunable via Tuner.(package private) static intDefault ceiling; operator may raise via PROP_MAX_MAX_STREAMS.private static intMax resend delay (ms).private static intDefault 8000 accommodates RTT up to ~4s with standard TCP deviation.private static intMax RTT to prevent pathological RTO cases.(package private) static intWindow at which slow start hands over to congestion avoidance @since 0.9.70+ mutable for adaptive tuning.static final intMinimum allowed message size.(package private) static final longMinimum gap enforced between RTO doublings.(package private) static final intMinimum congestion window size (one message in flight).private static longMinimum pacing rate.private static intMin resend delay.static final StringComma-separated list of allowed or blocked destination hashes.static final StringWhether to respond to ping messages.static final StringCongestion avoidance window growth rate factor.static final StringDelay before starting connection setup, in ms.static final StringSuppress connection rejection logging @since 0.9.4 default false.static final StringEnable destination access list filtering.static final StringEnable destination blacklist filtering.static final StringAction to take on inactivity timeout.static final StringIdle time before inactivity action fires, in ms.static final StringInitial delay before sending an ACK, in ms.static final StringInitial delay before retransmitting, in ms.private static final StringProp initial rto.static final StringInitial congestion window size (messages in flight).static final StringReset, drop, http, or custom string; default reset @since 0.9.34.static final Stringstatic final StringMax connections per day from a single peer.static final StringMax connections per hour from a single peer.static final StringMax connections per minute from a single peer.static final StringOperator-tunable ceiling for the Tuner'smaxConcurrentStreamsOverride.static final StringMaximum size of a streaming message, in bytes.static final StringMaximum number of times a message is resent.(package private) static final StringProp max rto.static final StringPer-tunnel cap on concurrent streams; a manager's effective cap is the min of this and the Tuner override.static final StringMax total connections per day across all peers.static final StringMax total connections per hour across all peers.static final StringMax total connections per minute across all peers.static final StringMaximum congestion window size.static final StringPassive flush delay in ms for MessageOutputStream.(package private) static final StringRTO multiplier as percentage (e.g.static final StringSlow start window growth rate factor.(package private) static final StringHow long an established connection may keep a packet in flight with no forward progress before it is force-closed, in ms.static final StringTag count below which the session treats itself as tag-short @since 0.9.34.static final StringNumber of ElGamal tags a session sends up front; default 40 @since 0.9.34.(package private) static intTuner-managed default for inbound packet receive workers, read when aPacketDispatcheris created.private static intGrowth factordoubleRTO()applies to the RTO on congestion, as a percentage; 100 means no growth, so the floor is 1.0x.private static final floatRFC 6298 RTT smoothing constants.private static final floatRtt beta.private static final floatRtt kappa.Fields inherited from class I2PSocketOptionsImpl
DEFAULT_BUFFER_SIZE, DEFAULT_CONNECT_TIMEOUT, DEFAULT_READ_TIMEOUT, DEFAULT_WRITE_TIMEOUTModifier and TypeFieldDescriptionstatic final intDefault max buffer size.static final intDefault base connect timeout in ms (30 seconds).static final intDefault read timeout in ms; -1 means block forever.static final intDefault write timeout in ms; -1 means never time out.Fields inherited from interface I2PSocketOptions
PROFILE_BULK, PROFILE_INTERACTIVE, PROP_BUFFER_SIZE, PROP_CONNECT_TIMEOUT, PROP_PROFILE, PROP_READ_TIMEOUT, PROP_WRITE_TIMEOUTModifier and TypeFieldDescriptionstatic final intProfile for bulk transfers (normal downloads/uploads).static final intProfile for interactive traffic (latency-sensitive, e.g.static final StringHow much data will we accept that hasn't been written out yet.static final StringBase time to wait for the ACK from a SYN, in milliseconds, before any adaptive scaling is applied.static final StringIf set, the profile used to prioritize packets on the network.static final StringHow long to block on read.static final StringHow long to block on write/flush.Constructor Summary
ConstructorsConstructorDescriptionCreate options with default values from system properties.ConnectionOptions(Properties opts) Create options initialized from the given properties.Create options as a copy of the given I2PSocketOptions, then apply system property defaults for streaming-specific fields.Create options as a deep copy of the given ConnectionOptions, applying system property defaults then overlaying all local fields.Method Summary
Modifier and TypeMethodDescriptionprivate voidapplyInt(Properties opts, String key, int def, boolean onlyIfSet, java.util.function.IntConsumer setter) Apply an integer property: if onlyIfSet, skip when property key is absent.private voidapplyLong(Properties opts, String key, long def, boolean onlyIfSet, java.util.function.LongConsumer setter) Long-valued sibling ofapplyInt(Properties, String, int, boolean, IntConsumer), for budgets expressed in ms.private voidapplyProperties(Properties opts, boolean onlyIfSet) Apply properties from opts.(package private) static intclampRttSample(int sample, int maxRtt) Pure clamp for a raw RTT sample before it enters the smoother.private voidRecalculate RTO from current smoothed RTT and deviation per RFC 6298.(package private) intDouble RTO after congestion per RFC 6298 sec.private static voidLog an error message against the ConnectionOptions log.(package private) static intThe Tuner's accept-worker override; 0 = no override, so the configuredi2p.streaming.acceptWorkerThreadsapplies.Access list.booleanWhether ping messages are answered.Destinations refused outright, consulted when blacklisting is enabled.private static booleangetBool(Properties opts, String name, boolean defaultVal) Parse a boolean property from opts.intIn congestion avoidance, window grows at 1/(windowSize*factor).intDelay before starting the connection.static intDefault congestion avoidance growth rate factor.static intDefault inactivity timeout.static intDefault initial ACK delay.static intDefault resend delay.static intDefault slow start growth rate factor.booleanWhether connection reject logging is suppressed.(package private) static intImmediate ack delay static.intAction taken when the inactivity timeout fires.intInactivity timeout before action in ms.intInbound buffer size.(package private) static intRetransmit timeout in ms armed before any RTT measurement exists.(package private) static intInitial window size."reset", "drop", "http", or custom string; default "reset" @since 0.9.34.(package private) static intThe Tuner's stream-cap override; 0 = none.longAbsolute cap on the time an outbound connect waits for a SYN ACK.intConcurrent stream ceiling a manager enforces; see PROP_MAX_STREAMS.intMax connections per day.intMax connections per hour.intMax connections per minute from a single peer.static intMaximum inbound buffer cap, tunable via Tuner.intLargest message to send in SYN; taken as the min of the current maximum message size andDEFAULT_MAX_MESSAGE_SIZE.(package private) static intOperator-tunable ceiling for the Tuner's stream-cap override.intMaximum message size (MTU/MRU).intMaximum packets to buffer regardless of byte size (hybrid byte+packet limit).private intInstance-scoped view of the global maximum resend delay.static intCeilingcomputeRTO()clamps the computed RTO to.intMaximum retries per message.private intInstance-scoped view of the global RTO backoff ceiling.static intCeiling the RTO backoff indoubleRTO()may reach.private intPer-connection view of the global RTT sample ceiling.static intMax RTT.(package private) static intMax slow start window static.intMax total connections per day.intMax total connections per hour.intMax total connections per minute.intMaximum window size cap.static longMin pacing rate.static intKB/s view ofgetMinPacingRate().private intInstance-scoped view of the global minimum resend delay.static intFloorcomputeRTO()clamps the computed RTO to.intMinimum RTT observed, greater than zero.intEffective passive flush delay in ms.intConnection profile.(package private) static intThe Tuner's receive-worker default; 0 = none.booleanWhether every packet on this connection must be signed, or only SYN/FIN-class packets.intDelay before retransmitting a packet in ms.intgetRTO()Retransmit timeout, clamped to [minResendDelay, maxResendDelay].(package private) static intFactordoubleRTO()scales the RTO by on congestion.intgetRTT()Smoothed round-trip time estimate in ms.(package private) intRTT deviation for RTO calculation.intDelay before sending a forced ACK when no data packets arrive.intIn slow start, window grows at 1/factor.longWall-clock ms an established connection may hold a packet in flight with no forward progress before being force-closed.intMostly handled on router side; PacketQueue needs to know for override limits @since 0.9.34.intTag count below which the session is considered tag-short.intMessages in flight before waiting for ACK.private voidinitFromProperties(Properties opts) Initialize from Properties with defaults (called from constructors).private voidInitialize inbound buffer size and packet count cap.private voidinitLists(Properties opts) Build the access/blacklist sets from a comma, semicolon or space separatedPROP_ACCESS_LIST, logging and skipping unparseable entries.private voidinitLists(ConnectionOptions opts) Copy the access/blacklist sets and their enable flags from another instance.booleanWhether the access list is enabled.booleanWhether the blacklist is enabled.booleanWhether a real RTT sample has ever been recorded for this connection.(package private) voidloadFromCache(int rtt, int rttDev, int wdw) Load cached RTT/deviation/window from TCB and transition directly to STEADY state.booleanHas at least one ACK been received?(package private) static voidsetAcceptWorkerThreads(int val) The Tuner's accept-worker override; clamped to [0, 16].voidsetAnswerPings(boolean yes) Whether ping messages are answered.voidsetCongestionAvoidanceGrowthRateFactor(int factor) Congestion avoidance growth rate factor.voidsetConnectDelay(int delayMs) Delay before starting the connection.static voidDefault congestion avoidance growth rate factor, clamped to [1, 4].static voidsetDefaultInactivityTimeout(int val) Default inactivity timeout, clamped to [60000, 600000] ms.static voidsetDefaultInitialAckDelay(int val) Default initial ACK delay, clamped to [10, 500] ms.static voidsetDefaultResendDelay(int val) Default resend delay, clamped to [100, 3000] ms.static voidsetDefaultSlowStartGrowthRateFactor(int val) Default slow start growth rate factor, clamped to [1, 4].voidsetDisableRejectLogging(boolean yes) Whether connection reject logging is suppressed.(package private) static voidsetImmediateAckDelay(int val) Immediate ack delay, clamped to [1, 1000] ms.voidsetInactivityAction(int action) Action taken when the inactivity timeout fires.voidsetInactivityTimeout(int timeout) Inactivity timeout before action.voidsetInboundBufferSize(int bytes) Inbound buffer size in bytes.(package private) static voidsetInitialRTO(int val) Retransmit timeout in ms used before any RTT measurement, clamped to [500, 30000].(package private) static voidsetInitialWindowSize(int val) Initial window size, clamped to [4, 1024] to match the Tuner's InitialWindowSizeParam bounds; the previous 512 cap silently truncated the param's 513-1024 range.(package private) static voidsetMaxConcurrentStreamsOverride(int val) The Tuner's stream-cap override; clamped to a sane [0, maxMaxConcurrentStreams].voidsetMaxConnectTimeout(long maxConnectTimeoutMs) Set an absolute cap on the time an outbound connect waits for a SYN ACK.static voidsetMaxInboundBufferStatic(int val) Maximum inbound buffer cap, clamped to [512KB, 64MB].voidsetMaxInitialMessageSize(int bytes) Largest message to send in SYN; stored unclamped.(package private) static voidsetMaxMaxConcurrentStreams(int val) Operator-tunable ceiling for the Tuner's stream-cap override; clamped to [64, 8192].voidsetMaxMessageSize(int bytes) Maximum message size, floored at MIN_MESSAGE_SIZE.static voidsetMaxResendDelay(int val) Ceiling on the computed RTO in ms, clamped to [1000, 60000].voidsetMaxResends(int numSends) Maximum retries per message.static voidsetMaxRTO(int val) Ceiling on the backed-off RTO in ms, clamped to [1000, 60000].static voidsetMaxRtt(int val) Max RTT, clamped to [1000, 60000] ms.(package private) static voidsetMaxSlowStartWindow(int val) Max slow start window, clamped to [8, Connection.ABSOLUTE_MAX_WINDOW].voidsetMaxWindowSize(int msgs) A value of 0 or less resets to the Tuner-managed global default.static voidsetMinPacingRate(long val) Min pacing rate.static voidsetMinPacingRateKBps(int val) KB/s wrapper for Tuner int reflection.static voidsetMinResendDelay(int val) Floor on the computed RTO in ms, clamped to [100, 5000].voidsetPassiveFlushDelay(int delayMs) Passive flush delay for the output stream.voidsetProfile(int profile) Connection profile.voidsetProperties(Properties opts) Update from properties — only applies explicitly set values.(package private) static voidsetReceiveWorkerThreads(int val) The Tuner's receive-worker default; clamped to a sane [0, PacketHandler.MAX_RECEIVE_WORKERS].voidsetRequireFullySigned(boolean sign) Whether all packets on this connection require signing.voidsetResendDelay(int ms) Resend delay, clamped to [minResendDelay, maxResendDelay].(package private) static voidsetRTOMultiplier(int val) RTO backoff factor as a percentage, clamped to [100, 500].private voidsetRTT(int ms) Smoothed RTT.private voidsetRTTDev(int rttDev) RTT deviation for RTO calculation.voidsetSendAckDelay(int delayMs) Changing the default is not recommended.voidsetSlowStartGrowthRateFactor(int factor) Slow start growth rate factor.voidsetStallGiveupMs(long ms) Wall-clock budget for giving up on forward progress.voidsetWindowSize(int numMsgs) Congestion window size in messages.toString()Human-readable summary of the options.private voidupdate(ConnectionOptions opts) Copy all local (streaming-specific) options from opts.voidupdateAll(ConnectionOptions opts) Copy all parent-class options then overlay ours from opts.voidupdateRTT(int measuredValue) Update the smoothed RTT with a new measurement.Methods inherited from class I2PSocketOptionsImpl
getConnectTimeout, getDouble, getInt, getLocalPort, getMaxBufferSize, getPort, getReadTimeout, getWriteTimeout, init, setConnectTimeout, setLocalPort, setMaxBufferSize, setPort, setReadTimeout, setWriteTimeoutModifier and TypeMethodDescriptionlongBase time to wait for the ACK from a SYN, in milliseconds.(package private) static doublegetDouble(Properties opts, String name, double defaultVal) Not part of the API, not for external use.protected static intgetInt(Properties opts, String name, int defaultVal) Parse an integer property value, with a default on failure.intThe local port.intHow much data will we accept that hasn't been written out yet.intgetPort()The remote port.longWhat is the longest we'll block on the input stream while waiting for more data.longWhat is the longest we'll block on the output stream while waiting for the data to flush.protected voidinit(Properties opts) Max buffer size, connect timeout, read timeout, and write timeout from properties.voidsetConnectTimeout(long ms) Define how long we will wait for the ACK from a SYN, in milliseconds.voidsetLocalPort(int port) The local port.voidsetMaxBufferSize(int numBytes) How much data will we accept that hasn't been written out yet.voidsetPort(int port) The remote port.voidsetReadTimeout(long ms) What is the longest we'll block on the input stream while waiting for more data.voidsetWriteTimeout(long ms) What is the longest we'll block on the output stream while waiting for the data to flush.
Field Details
_connectDelay
private int _connectDelayConnect delay._fullySigned
private boolean _fullySignedFully signed._answerPings
private boolean _answerPingsAnswer pings._windowSize
private volatile int _windowSizeWindow size._profile
private int _profileConnection traffic profile (only bulk supported)._maxConnectTimeout
private long _maxConnectTimeoutMax connect timeout override in ms, 0 = use globali2p.streaming.maxConnectTimeout._smoothedRtt
private volatile int _smoothedRttSmoothed rtt. Volatile: read from the throttle/retransmit hot path (writer thread, timer thread, reader thread) without the monitor the compound methods still use._minRtt
private volatile int _minRttMin rtt. Unknown until the first sample: seeding the floor with a guess (e.g. the initial RTT) would fabricate a minimum on any path whose real floor is higher, and _minRtt feeds the bandwidth-derived ssthresh floor. Like mainline: Integer.MAX_VALUE untilupdateRTT(int)narrows it._rttDeviation
private volatile int _rttDeviationRtt deviation._retransmitTimeout
private volatile int _retransmitTimeoutRetransmit timeout._retransmitDelay
private int _retransmitDelayRetransmit delay._ackDelay
private int _ackDelayAck delay._maxMessageSize
private int _maxMessageSizeMax message size._maxInitialMessageSize
private int _maxInitialMessageSizeMax initial message size._maxResends
private int _maxResendsMax resends._stallGiveupMs
private long _stallGiveupMsWall-clock ms an established connection may hold an unacked packet; see PROP_STALL_GIVEUP_MS._inactivityTimeout
private int _inactivityTimeoutInactivity timeout._inactivityAction
private int _inactivityActionInactivity action._inboundBufferSize
private volatile int _inboundBufferSizeInbound buffer size._maxWindowSize
private volatile int _maxWindowSizeMax window size._congestionAvoidanceGrowthRateFactor
private volatile int _congestionAvoidanceGrowthRateFactorCongestion avoidance growth rate factor._slowStartGrowthRateFactor
private volatile int _slowStartGrowthRateFactorSlow start growth rate factor._accessListEnabled
private volatile boolean _accessListEnabledAccess list enabled._blackListEnabled
private volatile boolean _blackListEnabledBlack list enabled._accessList
_blackList
_maxConnsPerMinute
private volatile int _maxConnsPerMinuteMax conns per minute._maxConnsPerHour
private volatile int _maxConnsPerHourMax conns per hour._maxConnsPerDay
private volatile int _maxConnsPerDayMax conns per day._maxTotalConnsPerMinute
private volatile int _maxTotalConnsPerMinuteMax total conns per minute._maxTotalConnsPerHour
private volatile int _maxTotalConnsPerHourMax total conns per hour._maxTotalConnsPerDay
private volatile int _maxTotalConnsPerDayMax total conns per day._passiveFlushDelay
private volatile int _passiveFlushDelayPer-connection passive flush delay; <= 0 means use Tuner-managed global default._maxConns
private volatile int _maxConnsMax conns._disableRejectLog
private volatile boolean _disableRejectLogDisable reject log._limitAction
Limit action._tagsToSend
private volatile int _tagsToSendTags to send._tagThreshold
private volatile int _tagThresholdTag threshold._lastRtoDoubleTime
private long _lastRtoDoubleTimePrevents RTO overshoot from rapid RetransmitEvent + ResendPacketEvent double-fires._nanoTime
java.util.function.LongSupplier _nanoTimeNanosecond time source for the RTO-doubling gap.Package-visible and replaceable so the gap can be tested without burning real time: the guard is
MIN_RTO_DOUBLE_GAP_MSat minimum, so a test that exercises it honestly has to wait a second per iteration._maxPacketCount
private volatile int _maxPacketCountHybrid byte+packet buffer limit; default 1024 for optimal performance._rttState
Synchronizes access to the RTT state.INACTIVITY_ACTION_NOOP
public static final int INACTIVITY_ACTION_NOOPNo action taken when inactivity timeout fires.- See Also:
INACTIVITY_ACTION_DISCONNECT
public static final int INACTIVITY_ACTION_DISCONNECTDisconnect the connection when inactivity timeout fires.- See Also:
INACTIVITY_ACTION_SEND
public static final int INACTIVITY_ACTION_SENDSend a keepalive when inactivity timeout fires.- See Also:
RTT_ALPHA
RTT_BETA
RTT_KAPPA
MIN_RTO_DOUBLE_GAP_MS
static final long MIN_RTO_DOUBLE_GAP_MSMinimum gap enforced between RTO doublings. Floors the once-per-RTT guard indoubleRTO()so a degenerately small smoothed RTT cannot make the guard a no-op.- See Also:
PROP_INITIAL_RTO
PROP_MAX_RTO
PROP_STALL_GIVEUP_MS
How long an established connection may keep a packet in flight with no forward progress before it is force-closed, in ms.Deliberately its own setting rather than a product of
maxResendsandmaxRTO.maxResendsis the per-packet budget and governs loss tolerance; multiplying it by an RTO cap produced a four-minute connection lifetime as a side effect of a loss-tolerance knob. While the client tunnel pool is short of healthy tunnels, every second a dead stream is held is a second it occupies capacity that a live stream needs, and the resulting reconnects starve the pool further. Ninety seconds still rides out several firings past the RTO cap, so a genuinely transient loss survives.- See Also:
defaultInitialRTO
private static volatile int defaultInitialRTODefault initial RTO (ms) before any RTT measurement. Set to 9000 — accommodates typical I2P RTT up to ~6s without premature SYN retransmit, matching i2pd's INITIAL_RTO. The Tuner adjusts this adaptively based on network conditions.maxRTO
private static volatile int maxRTODefault 8000 accommodates RTT up to ~4s with standard TCP deviation. Shorter than the historical 30000 so a stalled path costs less: a lost packet blocks the stream head-of-line until its RTO backoff expires, and the Tuner only tightens this on paths that keep confirming sends. On a dead path (no confirmTime events) the Tuner sees no signal, so the code default IS the retransmit pace and the zombie-window backstop (maxResends * maxRTO) for that path. 8000 keeps each loss stall modest and the default 30-resend backstop (~4 min) inside a range a recovered path can still resume from, instead of the 15-min hang the 30s default gave. Tuner may raise this for very high-latency networks.PROP_RTO_MULTIPLIER
RTO multiplier as percentage (e.g. 120 = 1.2x), clamped to [100, 500].- See Also:
rtoMultiplier
private static volatile int rtoMultiplierGrowth factordoubleRTO()applies to the RTO on congestion, as a percentage; 100 means no growth, so the floor is 1.0x.minResendDelay
private static volatile int minResendDelayMin resend delay.maxResendDelay
private static volatile int maxResendDelayMax resend delay (ms). Raised to 20000 to accommodate high-RTT paths without premature retransmit while still providing faster recovery than the 30000 default.PROP_CONNECT_DELAY
Delay before starting connection setup, in ms.- See Also:
PROP_MAX_CONNECT_TIMEOUT
- See Also:
PROP_MAX_MESSAGE_SIZE
Maximum size of a streaming message, in bytes.- See Also:
PROP_MAX_RESENDS
Maximum number of times a message is resent.- See Also:
PROP_INITIAL_RESEND_DELAY
Initial delay before retransmitting, in ms.- See Also:
PROP_INITIAL_ACK_DELAY
Initial delay before sending an ACK, in ms.- See Also:
PROP_INITIAL_WINDOW_SIZE
Initial congestion window size (messages in flight).- See Also:
PROP_INACTIVITY_TIMEOUT
Idle time before inactivity action fires, in ms.- See Also:
PROP_INACTIVITY_ACTION
Action to take on inactivity timeout.- See Also:
PROP_MAX_WINDOW_SIZE
Maximum congestion window size.- See Also:
PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR
Congestion avoidance window growth rate factor.- See Also:
PROP_SLOW_START_GROWTH_RATE_FACTOR
Slow start window growth rate factor.- See Also:
PROP_ANSWER_PINGS
Whether to respond to ping messages.- See Also:
PROP_ENABLE_ACCESS_LIST
Enable destination access list filtering.- See Also:
PROP_ENABLE_BLACKLIST
Enable destination blacklist filtering.- See Also:
PROP_ACCESS_LIST
Comma-separated list of allowed or blocked destination hashes.- See Also:
PROP_MAX_CONNS_MIN
Max connections per minute from a single peer.- See Also:
PROP_MAX_CONNS_HOUR
Max connections per hour from a single peer.- See Also:
PROP_MAX_CONNS_DAY
Max connections per day from a single peer.- See Also:
PROP_MAX_TOTAL_CONNS_MIN
Max total connections per minute across all peers.- See Also:
PROP_MAX_TOTAL_CONNS_HOUR
Max total connections per hour across all peers.- See Also:
PROP_MAX_TOTAL_CONNS_DAY
Max total connections per day across all peers.- See Also:
PROP_MAX_STREAMS
Per-tunnel cap on concurrent streams; a manager's effective cap is the min of this and the Tuner override.- See Also:
PROP_MAX_MAX_STREAMS
Operator-tunable ceiling for the Tuner'smaxConcurrentStreamsOverride. The effective cap taken by a manager is the min of its configured value (PROP_MAX_STREAMS) and the override, so this only bounds the Tuner; it can never raise a manager above its own per-tunnel ceiling.- See Also:
maxMaxConcurrentStreams
static volatile int maxMaxConcurrentStreamsDefault ceiling; operator may raise via PROP_MAX_MAX_STREAMS. @since 0.9.71+.PROP_DISABLE_REJ_LOG
Suppress connection rejection logging @since 0.9.4 default false.- See Also:
PROP_LIMIT_ACTION
Reset, drop, http, or custom string; default reset @since 0.9.34.- See Also:
PROP_TAGS_TO_SEND
Number of ElGamal tags a session sends up front; default 40 @since 0.9.34.- See Also:
PROP_TAG_THRESHOLD
Tag count below which the session treats itself as tag-short @since 0.9.34.- See Also:
PROP_PASSIVE_FLUSH_DELAY
Passive flush delay in ms for MessageOutputStream. When set to 0 (default), uses the Tuner-managed global default. When profile is INTERACTIVE and no explicit value is set, defaults to half the Tuner global (min 10).- See Also:
initialWindowSize
static volatile int initialWindowSizeRFC 6928 recommends 10; raised to 64 in 0.9.48 for I2P's high-latency environment and to 128 for the 0.9.71+ fast-ramp profile: each stream starts with up to 128 messages in flight, so the first RTT on a high-bandwidth path is not spent proving link capacity.DEFAULT_MAX_SENDS
static final int DEFAULT_MAX_SENDSDefault maximum number of times a single message will be retransmitted.- See Also:
DEFAULT_STALL_GIVEUP_MS
static final long DEFAULT_STALL_GIVEUP_MSDefault wall-clock budget for giving up on forward progress. SeePROP_STALL_GIVEUP_MS.- See Also:
maxConcurrentStreamsOverride
static volatile int maxConcurrentStreamsOverrideReactive cap on concurrent streams (both per-manager inbound budget and the outbound wait queue), written by the router's Tuner under saturation. Applies to every ConnectionManager. 0 (the default) means "no override": each manager uses its own configuredi2p.streaming.maxConcurrentStreamscaptured at init. When positive, a manager enforces themin(configured, override).receiveWorkerThreads
static volatile int receiveWorkerThreadsTuner-managed default for inbound packet receive workers, read when aPacketDispatcheris created. 0 (the default) means "no override": each manager uses its configuredi2p.streaming.receiveWorkerThreadsor the platform core count. When positive, new dispatchers start with this many shards; the Tuner also resizes live dispatchers viaPacketDispatcher.resizeAll. Bounded by the per-manager cap used by PacketHandler.acceptWorkerThreads
static volatile int acceptWorkerThreadsAccept worker threads, Tuner-managed override; 0 = no override. @since 0.9.71+.DEFAULT_INITIAL_RTT
public static final int DEFAULT_INITIAL_RTTInitial RTT estimate before first measurement. I2P typically has 2-10s RTT, so 2s provides a conservative starting point without a long initial recovery window.- See Also:
maxRTT
private static volatile int maxRTTMax RTT to prevent pathological RTO cases. Tunable viai2p.streaming.maxRtt(default 10000).defaultInitialAckDelay
private static volatile int defaultInitialAckDelay500ms provides a reasonable delayed-ACK window for I2P's high-latency, allowing data piggybacking and reducing ACK-only packet floods. Ref: RFC 5681 sec. 4.3, RFC 1122 sec. 4.2.3.3, ticket #2706.MIN_WINDOW_SIZE
static final int MIN_WINDOW_SIZEMinimum congestion window size (one message in flight).- See Also:
DEFAULT_ANSWER_PINGS
private static final boolean DEFAULT_ANSWER_PINGSDefault answer pings.- See Also:
defaultInactivityTimeout
static volatile int defaultInactivityTimeoutIdle time before the inactivity action fires; default 300s @since 0.9.70+ mutable for adaptive tuning.DEFAULT_INACTIVITY_ACTION
private static final int DEFAULT_INACTIVITY_ACTIONDefault inactivity action.- See Also:
maxSlowStartWindow
static volatile int maxSlowStartWindowWindow at which slow start hands over to congestion avoidance @since 0.9.70+ mutable for adaptive tuning.immediateAckDelay
private static volatile int immediateAckDelayImmediate ack delay.defaultRetransmitDelay
private static volatile int defaultRetransmitDelayDelay before the first retransmit of a packet, in ms; the fallback forPROP_INITIAL_RESEND_DELAYwhen that property is absent.defaultCongestionAvoidanceGrowthRateFactor
private static volatile int defaultCongestionAvoidanceGrowthRateFactorDivisor the linear congestion-avoidance growth uses, so the window gains roughly 1/N messages per RTT; 1 is the slowest (1 per RTT).defaultSlowStartGrowthRateFactor
private static volatile int defaultSlowStartGrowthRateFactorDivisor the slow-start growth uses, so the window gains roughly acked/N messages per ACK; 1 is the fastest (a full acked per ACK).minPacingRate
private static volatile long minPacingRateMinimum pacing rate. Below this, pacing is disabled to avoid excessive delays. Default 16 KB/s, tunable via Tuner.DEFAULT_LIMIT_ACTION
Action taken when connections exceed a limit; one of "reset", "drop", "http" @since 0.9.34.- See Also:
DEFAULT_TAGS_TO_SEND
public static final int DEFAULT_TAGS_TO_SENDElGamal tags sent up front before blocking on tag generation; default 40 @since 0.9.34.- See Also:
DEFAULT_TAG_THRESHOLD
public static final int DEFAULT_TAG_THRESHOLDTag count below which the session is considered tag-short; default 30 @since 0.9.34.- See Also:
DEFAULT_MAX_MESSAGE_SIZE
public static final int DEFAULT_MAX_MESSAGE_SIZEDefault maximum streaming message payload size, derived from 2 tunnel messages.- See Also:
MIN_MESSAGE_SIZE
DEFAULT_MAX_MESSAGE_SIZE_RATCHET
public static final int DEFAULT_MAX_MESSAGE_SIZE_RATCHETOverride max message size for ratcheted connections per proposal 144 @since 0.9.47.- See Also:
maxInboundBuffer
private static volatile int maxInboundBufferMaximum inbound buffer cap, tunable via Tuner. Default 8MB accommodates high-BDP paths without excess memory use.
Constructor Details
ConnectionOptions
public ConnectionOptions()Create options with default values from system properties.ConnectionOptions
Create options initialized from the given properties.- Parameters:
opts- properties to initialize from, may be null
ConnectionOptions
Create options as a copy of the given I2PSocketOptions, then apply system property defaults for streaming-specific fields.- Parameters:
opts- options to copy, may be null
ConnectionOptions
Create options as a deep copy of the given ConnectionOptions, applying system property defaults then overlaying all local fields.- Parameters:
opts- options to copy, may be null
Method Details
getInitialRTO
static int getInitialRTO()Retransmit timeout in ms armed before any RTT measurement exists.- Returns:
- the initial RTO in ms
setInitialRTO
static void setInitialRTO(int val) Retransmit timeout in ms used before any RTT measurement, clamped to [500, 30000].- Parameters:
val- the initial RTO in ms
getMaxRTOStatic
public static int getMaxRTOStatic()Ceiling the RTO backoff indoubleRTO()may reach.- Returns:
- the max RTO in ms
setMaxRTO
public static void setMaxRTO(int val) Ceiling on the backed-off RTO in ms, clamped to [1000, 60000].- Parameters:
val- the max RTO in ms
getRTOMultiplier
static int getRTOMultiplier()FactordoubleRTO()scales the RTO by on congestion.- Returns:
- the multiplier percentage (120 = 1.2x)
setRTOMultiplier
static void setRTOMultiplier(int val) RTO backoff factor as a percentage, clamped to [100, 500].- Parameters:
val- the multiplier percentage (100 = no growth)
getMinResendDelayStatic
public static int getMinResendDelayStatic()FloorcomputeRTO()clamps the computed RTO to.- Returns:
- the min resend delay in ms
setMinResendDelay
public static void setMinResendDelay(int val) Floor on the computed RTO in ms, clamped to [100, 5000].- Parameters:
val- the min resend delay in ms
getMaxResendDelayStatic
public static int getMaxResendDelayStatic()CeilingcomputeRTO()clamps the computed RTO to.- Returns:
- the max resend delay in ms
setMaxResendDelay
public static void setMaxResendDelay(int val) Ceiling on the computed RTO in ms, clamped to [1000, 60000].- Parameters:
val- the max resend delay in ms
getMaxRTO
private int getMaxRTO()Instance-scoped view of the global RTO backoff ceiling.- Returns:
- the max RTO in ms
getMinResendDelay
private int getMinResendDelay()Instance-scoped view of the global minimum resend delay.- Returns:
- the min resend delay in ms
getMaxResendDelay
private int getMaxResendDelay()Instance-scoped view of the global maximum resend delay.- Returns:
- the max resend delay in ms
getInitialWindowSize
static int getInitialWindowSize()Initial window size.- Returns:
- messages in flight at connection setup
setInitialWindowSize
static void setInitialWindowSize(int val) Initial window size, clamped to [4, 1024] to match the Tuner's InitialWindowSizeParam bounds; the previous 512 cap silently truncated the param's 513-1024 range.- Parameters:
val- messages in flight to start with
getMaxConcurrentStreamsOverride
static int getMaxConcurrentStreamsOverride()The Tuner's stream-cap override; 0 = none. @since 0.9.71+.- Returns:
- the reactive stream-cap override
setMaxConcurrentStreamsOverride
static void setMaxConcurrentStreamsOverride(int val) The Tuner's stream-cap override; clamped to a sane [0, maxMaxConcurrentStreams]. @since 0.9.71+.- Parameters:
val- the reactive stream-cap override; 0 means no override
getReceiveWorkerThreads
static int getReceiveWorkerThreads()The Tuner's receive-worker default; 0 = none. @since 0.9.71+.- Returns:
- the reactive receive-worker default
setReceiveWorkerThreads
static void setReceiveWorkerThreads(int val) The Tuner's receive-worker default; clamped to a sane [0, PacketHandler.MAX_RECEIVE_WORKERS]. @since 0.9.71+.- Parameters:
val- the reactive receive-worker default; 0 means no override
getAcceptWorkerThreads
static int getAcceptWorkerThreads()The Tuner's accept-worker override; 0 = no override, so the configuredi2p.streaming.acceptWorkerThreadsapplies. @since 0.9.71+.- Returns:
- the reactive accept-worker override, or 0 if none
setAcceptWorkerThreads
static void setAcceptWorkerThreads(int val) The Tuner's accept-worker override; clamped to [0, 16]. @since 0.9.71+.- Parameters:
val- the reactive accept-worker override; 0 removes it
getMaxMaxConcurrentStreams
static int getMaxMaxConcurrentStreams()Operator-tunable ceiling for the Tuner's stream-cap override. Reads fromrouter.configviai2p.streaming.maxMaxConcurrentStreams, falling back to the compiled default.- Returns:
- the current ceiling
setMaxMaxConcurrentStreams
static void setMaxMaxConcurrentStreams(int val) Operator-tunable ceiling for the Tuner's stream-cap override; clamped to [64, 8192].- Parameters:
val- the ceiling on the stream-cap override
getMaxRtt
private int getMaxRtt()Per-connection view of the global RTT sample ceiling.- Returns:
- the max RTT in ms
setMaxRtt
public static void setMaxRtt(int val) Max RTT, clamped to [1000, 60000] ms.- Parameters:
val- the per-connection RTT sample ceiling in ms
getMaxRttStatic
public static int getMaxRttStatic()Max RTT.- Returns:
- the max rtt static
getDefaultInitialAckDelay
public static int getDefaultInitialAckDelay()Default initial ACK delay.- Returns:
- the default initial ack delay
setDefaultInitialAckDelay
public static void setDefaultInitialAckDelay(int val) Default initial ACK delay, clamped to [10, 500] ms.- Parameters:
val- the initial ACK delay in ms
getDefaultInactivityTimeout
public static int getDefaultInactivityTimeout()Default inactivity timeout.- Returns:
- the default inactivity timeout
setDefaultInactivityTimeout
public static void setDefaultInactivityTimeout(int val) Default inactivity timeout, clamped to [60000, 600000] ms.- Parameters:
val- the idle time before the inactivity action fires, in ms
getMaxSlowStartWindowStatic
static int getMaxSlowStartWindowStatic()Max slow start window static.- Returns:
- the slow-start/CA handover threshold in messages
setMaxSlowStartWindow
static void setMaxSlowStartWindow(int val) Max slow start window, clamped to [8, Connection.ABSOLUTE_MAX_WINDOW].- Parameters:
val- the slow-start/CA handover threshold in messages
getImmediateAckDelayStatic
static int getImmediateAckDelayStatic()Immediate ack delay static.- Returns:
- the cap in ms on how soon an immediate ACK may be scheduled
setImmediateAckDelay
static void setImmediateAckDelay(int val) Immediate ack delay, clamped to [1, 1000] ms.- Parameters:
val- the cap in ms on how soon an immediate ACK may be scheduled
getDefaultResendDelayStatic
public static int getDefaultResendDelayStatic()Default resend delay.- Returns:
- the default resend delay static
setDefaultResendDelay
public static void setDefaultResendDelay(int val) Default resend delay, clamped to [100, 3000] ms.- Parameters:
val- the default resend delay in ms
getDefaultCongestionAvoidanceGrowthRateFactorStatic
public static int getDefaultCongestionAvoidanceGrowthRateFactorStatic()Default congestion avoidance growth rate factor.- Returns:
- the default congestion avoidance growth rate factor static
setDefaultCongestionAvoidanceGrowthRateFactor
public static void setDefaultCongestionAvoidanceGrowthRateFactor(int val) Default congestion avoidance growth rate factor, clamped to [1, 4].- Parameters:
val- the congestion avoidance growth rate factor
getDefaultSlowStartGrowthRateFactorStatic
public static int getDefaultSlowStartGrowthRateFactorStatic()Default slow start growth rate factor.- Returns:
- the default slow start growth rate factor static
setDefaultSlowStartGrowthRateFactor
public static void setDefaultSlowStartGrowthRateFactor(int val) Default slow start growth rate factor, clamped to [1, 4].- Parameters:
val- the slow start growth rate factor
getMinPacingRate
public static long getMinPacingRate()Min pacing rate.- Returns:
- the min pacing rate
setMinPacingRate
public static void setMinPacingRate(long val) Min pacing rate.- Parameters:
val- the floor on pacing throughput in bytes/sec
getMinPacingRateKBps
public static int getMinPacingRateKBps()KB/s view ofgetMinPacingRate().- Returns:
- the floor on pacing throughput in KB/s, rounded down
setMinPacingRateKBps
public static void setMinPacingRateKBps(int val) KB/s wrapper for Tuner int reflection.- Parameters:
val- the floor on pacing throughput in KB/s, clamped to [1, 256]
updateAll
Copy all parent-class options then overlay ours from opts.- Parameters:
opts- source options to copy from, may be null
update
Copy all local (streaming-specific) options from opts. Note:getMaxWindowSize()returns the effective value (clamped by the Tuner global), so copying that would pin the destination's window down- only if the global ever decreased. Copy the raw configured value instead so a later Tuner re-enable propagates to this connection.- Parameters:
opts- source options to copy from, may be null
initFromProperties
Initialize from Properties with defaults (called from constructors). Applies configured values or defaults for all properties.- Parameters:
opts- properties to initialize from, may be null
setProperties
Update from properties — only applies explicitly set values. Also handles PROP_CONNECT_TIMEOUT not covered by applyProperties (it's in the parent class's constructor path).- Overrides:
setPropertiesin classI2PSocketOptionsImpl- Parameters:
opts- properties to apply, may be null
applyProperties
Apply properties from opts. When onlyIfSet is true, only properties explicitly present in opts are applied (used bysetProperties(Properties)). When false, defaults are applied for missing properties (used by constructors).- Parameters:
opts- properties to read from, ignored when nullonlyIfSet- if true, only properties present in opts are applied
applyInt
private void applyInt(Properties opts, String key, int def, boolean onlyIfSet, java.util.function.IntConsumer setter) Apply an integer property: if onlyIfSet, skip when property key is absent. Otherwise apply value (or default).- Parameters:
opts- properties to read from, may be nullkey- property key to look updef- default value if key is absentonlyIfSet- if true, skip when key is not present in optssetter- consumer to apply the parsed value
applyLong
private void applyLong(Properties opts, String key, long def, boolean onlyIfSet, java.util.function.LongConsumer setter) Long-valued sibling ofapplyInt(Properties, String, int, boolean, IntConsumer), for budgets expressed in ms.- Parameters:
opts- properties to read from, ignored when nullkey- property key to look updef- default in ms used when key is absent or unparseableonlyIfSet- if true, skip when key is not present in optssetter- consumer to apply the parsed value
getConnectDelay
public int getConnectDelay()Delay before starting the connection.- Returns:
- delay before starting connection, in ms
setConnectDelay
public void setConnectDelay(int delayMs) Delay before starting the connection.- Parameters:
delayMs- delay before starting connection, in ms
getMaxConnectTimeout
public long getMaxConnectTimeout()Absolute cap on the time an outbound connect waits for a SYN ACK. 0 (the default) is not a real cap; the router-widePROP_MAX_CONNECT_TIMEOUTvalue is used instead.- Returns:
- cap in ms, or 0 to use the global default
setMaxConnectTimeout
public void setMaxConnectTimeout(long maxConnectTimeoutMs) Set an absolute cap on the time an outbound connect waits for a SYN ACK. Overrides the router-widePROP_MAX_CONNECT_TIMEOUTvalue for this connection. This is what lets per-tunnel client options (e.g. the IRC client tunnel) raise the ceiling above the global default.- Parameters:
maxConnectTimeoutMs- cap in ms, or <= 0 to use the global default
getRequireFullySigned
public boolean getRequireFullySigned()Whether every packet on this connection must be signed, or only SYN/FIN-class packets.Defaults to false, and no property or GUI setting exposes it: it is only ever set in-process via
setRequireFullySigned(boolean)and carried to a new connection when options are copied from an existing one. When true it takes effect in both directions: every outbound packet gets FLAG_SIGNATURE_INCLUDED and FLAG_SIGNATURE_REQUESTED, and ConnectionPacketHandler rejects any inbound packet that does not carry a valid signature.- Returns:
- true if all packets must be signed, false for SYN/FIN only
setRequireFullySigned
public void setRequireFullySigned(boolean sign) Whether all packets on this connection require signing. SeegetRequireFullySigned()for the effect; there is no property to configure this with.- Parameters:
sign- true to require all packets signed
getAnswerPings
public boolean getAnswerPings()Whether ping messages are answered.- Returns:
- true if ping messages are answered
setAnswerPings
public void setAnswerPings(boolean yes) Whether ping messages are answered.- Parameters:
yes- true to respond to pings
getDisableRejectLogging
public boolean getDisableRejectLogging()Whether connection reject logging is suppressed.- Returns:
- true if connection reject logging is suppressed
setDisableRejectLogging
public void setDisableRejectLogging(boolean yes) Whether connection reject logging is suppressed.- Parameters:
yes- true to suppress reject log messages
getWindowSize
public int getWindowSize()Messages in flight before waiting for ACK.- Returns:
- current congestion window size in messages
setWindowSize
public void setWindowSize(int numMsgs) Congestion window size in messages.- Parameters:
numMsgs- clamped to [MIN_WINDOW_SIZE, maxWindowSize]
getRTT
public int getRTT()Smoothed round-trip time estimate in ms.- Returns:
- current SRTT value in ms
isRTTEstablished
public boolean isRTTEstablished()Whether a real RTT sample has ever been recorded for this connection.Until the first sample arrives,
getRTT()andgetWindowSize()hold the class defaults rather than a measurement. A connection torn down before that — a hard kill during connect, say — must not have those defaults published as though they were observed, or every such teardown biases the lifetime aggregates the Tuner reads toward the floor.- Returns:
- true if at least one RTT sample has been recorded
getMinRTT
public int getMinRTT()Minimum RTT observed, greater than zero.- Returns:
- minimum RTT in ms
setRTT
private void setRTT(int ms) Smoothed RTT. Not public, use updateRTT().The value is NOT clamped to maxRtt here: clamping the smoothed value lets a stale outlier pin steady-state RTT at the ceiling, which in turn pins RTO at its max and locks the recovery cadence. Single samples are already clamped at ingestion (see
updateRTT(int)), and RTO is independently bounded bycomputeRTO(), so the smoothed value tracks the path honestly.- Parameters:
ms- new RTT value in ms
clampRttSample
static int clampRttSample(int sample, int maxRtt) Pure clamp for a raw RTT sample before it enters the smoother.A clearly pathological single sample (e.g. tens of seconds from a stale reference after a long idle) must not inject a step into the smoothed RTT / RTO; the sample is reined to the per-connection ceiling instead. Zero and negative samples pass through unchanged so the caller's sentinel handling is preserved.
- Parameters:
sample- raw measured RTT in ms (may be negative or zero)maxRtt- per-connection sample ceiling in ms; <= 0 disables clamping- Returns:
- sample clamped to [0, maxRtt]
getRTO
public int getRTO()Retransmit timeout, clamped to [minResendDelay, maxResendDelay].- Returns:
- current RTO in ms
getRTTDev
int getRTTDev()RTT deviation for RTO calculation.- Returns:
- RTT variance in ms
setRTTDev
private void setRTTDev(int rttDev) RTT deviation for RTO calculation.- Parameters:
rttDev- RTT deviation in ms
loadFromCache
void loadFromCache(int rtt, int rttDev, int wdw) Load cached RTT/deviation/window from TCB and transition directly to STEADY state.- Parameters:
rtt- cached RTT value in msrttDev- cached RTT deviation in mswdw- cached window size
computeRTO
private void computeRTO()Recalculate RTO from current smoothed RTT and deviation per RFC 6298.doubleRTO
int doubleRTO()Double RTO after congestion per RFC 6298 sec. 5 item 5.5. Guards against rapid double-fires from RetransmitEvent + ResendPacketEvent by limiting to once per RTT, floored atMIN_RTO_DOUBLE_GAP_MSso a degenerate smoothed RTT cannot turn the guard into a no-op.- Returns:
- the new RTO value in ms
updateRTT
public void updateRTT(int measuredValue) Update the smoothed RTT with a new measurement.The dropout sample is clamped before entering the smoother (
clampRttSample(int, int)) so a single pathological reading can never pin the smoothed RTT (and thus the RTO recovery cadence) at the ceiling. The minimum-RTT floor is updated from therawvalue instead: it feeds the bandwidth-derived ssthresh, and clamping it first would fabricate a 10s floor on any path slower than maxRtt.- Parameters:
measuredValue- must be positive
receivedAck
public boolean receivedAck()Has at least one ACK been received?- Returns:
- true once an ACK has advanced the RTT state machine past INIT
getResendDelay
public int getResendDelay()Delay before retransmitting a packet in ms.- Returns:
- the retransmit timer delay in ms
setResendDelay
public void setResendDelay(int ms) Resend delay, clamped to [minResendDelay, maxResendDelay].- Parameters:
ms- the retransmit timer delay in ms
getSendAckDelay
public int getSendAckDelay()Delay before sending a forced ACK when no data packets arrive. Ref: RFC 5681 sec. 4.3, RFC 1122 sec. 4.2.3.3, ticket #2706.- Returns:
- the send ack delay
setSendAckDelay
public void setSendAckDelay(int delayMs) Changing the default is not recommended. Ref: RFC 5681 sec. 4.3, RFC 1122 sec. 4.2.3.3, ticket #2706.- Parameters:
delayMs- delay before a forced ACK, clamped to [10, 500] ms
getMaxMessageSize
public int getMaxMessageSize()Maximum message size (MTU/MRU).- Returns:
- the message size cap in bytes
setMaxMessageSize
public void setMaxMessageSize(int bytes) Maximum message size, floored at MIN_MESSAGE_SIZE.- Parameters:
bytes- the message size cap in bytes
getMaxInitialMessageSize
public int getMaxInitialMessageSize()Largest message to send in SYN; taken as the min of the current maximum message size andDEFAULT_MAX_MESSAGE_SIZE. @since 0.9.47.- Returns:
- the SYN message size in bytes
setMaxInitialMessageSize
public void setMaxInitialMessageSize(int bytes) Largest message to send in SYN; stored unclamped.- Parameters:
bytes- the SYN message size in bytes
getProfile
public int getProfile()Connection profile. Only bulk is supported. @since 0.9.64.- Returns:
- the traffic profile
setProfile
public void setProfile(int profile) Connection profile.- Parameters:
profile- the traffic profile; only bulk is supported
getPassiveFlushDelay
public int getPassiveFlushDelay()Effective passive flush delay in ms.- Returns:
- effective passive flush delay in ms: explicit value if set, otherwise the Tuner-managed global default
setPassiveFlushDelay
public void setPassiveFlushDelay(int delayMs) Passive flush delay for the output stream.- Parameters:
delayMs- 0 to use Tuner-managed global default, positive for explicit delay
getMaxResends
public int getMaxResends()Maximum retries per message.- Returns:
- the per-packet resend budget
getStallGiveupMs
public long getStallGiveupMs()Wall-clock ms an established connection may hold a packet in flight with no forward progress before being force-closed.- Returns:
- the stall give-up budget in ms
setStallGiveupMs
public void setStallGiveupMs(long ms) Wall-clock budget for giving up on forward progress. SeePROP_STALL_GIVEUP_MS.- Parameters:
ms- wall-clock budget in ms; negative or zero disables the backstop
setMaxResends
public void setMaxResends(int numSends) Maximum retries per message.- Parameters:
numSends- the per-packet resend budget; negative values clamp to 0, which disables the retransmit give-up
getInactivityTimeout
public int getInactivityTimeout()Inactivity timeout before action in ms.- Returns:
- the idle time before the inactivity action fires, in ms
setInactivityTimeout
public void setInactivityTimeout(int timeout) Inactivity timeout before action.- Parameters:
timeout- the idle time before the inactivity action fires, in ms; stored unclamped
getInactivityAction
public int getInactivityAction()Action taken when the inactivity timeout fires.- Returns:
- the inactivity action
setInactivityAction
public void setInactivityAction(int action) Action taken when the inactivity timeout fires.- Parameters:
action- one of INACTIVITY_ACTION_NOOP, _DISCONNECT or _SEND
getMaxWindowSize
public int getMaxWindowSize()Maximum window size cap.- Returns:
- per-connection cap if set, otherwise the Tuner-managed global ceiling
setMaxWindowSize
public void setMaxWindowSize(int msgs) A value of 0 or less resets to the Tuner-managed global default. Clamped to [2, ABSOLUTE_MAX_WINDOW].- Parameters:
msgs- messages in flight; <= 0 clears the per-connection override
getInboundBufferSize
public int getInboundBufferSize()Inbound buffer size.- Returns:
- the inbound buffer size
setInboundBufferSize
public void setInboundBufferSize(int bytes) Inbound buffer size in bytes.- Parameters:
bytes- the receive buffer size in bytes, stored unclamped
getMaxPacketCount
public int getMaxPacketCount()Maximum packets to buffer regardless of byte size (hybrid byte+packet limit).- Returns:
- the inbound packet-count cap
getCongestionAvoidanceGrowthRateFactor
public int getCongestionAvoidanceGrowthRateFactor()In congestion avoidance, window grows at 1/(windowSize*factor). I2P uses messages vs TCP's bytes, so factor=maxMessageSize mimics TCP; smaller factor grows faster.- Returns:
- the congestion avoidance growth rate factor
setCongestionAvoidanceGrowthRateFactor
public void setCongestionAvoidanceGrowthRateFactor(int factor) Congestion avoidance growth rate factor.- Parameters:
factor- window growth divisor in congestion avoidance
getSlowStartGrowthRateFactor
public int getSlowStartGrowthRateFactor()In slow start, window grows at 1/factor. factor=maxMessageSize mimics TCP; smaller factor grows faster.- Returns:
- the slow start growth rate factor
setSlowStartGrowthRateFactor
public void setSlowStartGrowthRateFactor(int factor) Slow start growth rate factor.- Parameters:
factor- window growth divisor during slow start
getMaxConnsPerMinute
public int getMaxConnsPerMinute()Max connections per minute from a single peer.- Returns:
- the max conns per minute
getMaxConnsPerHour
public int getMaxConnsPerHour()Max connections per hour.- Returns:
- the max conns per hour
getMaxConnsPerDay
public int getMaxConnsPerDay()Max connections per day.- Returns:
- the max conns per day
getMaxTotalConnsPerMinute
public int getMaxTotalConnsPerMinute()Max total connections per minute.- Returns:
- the max total conns per minute
getMaxTotalConnsPerHour
public int getMaxTotalConnsPerHour()Max total connections per hour.- Returns:
- the max total conns per hour
getMaxTotalConnsPerDay
public int getMaxTotalConnsPerDay()Max total connections per day.- Returns:
- the max total conns per day
getMaxConns
public int getMaxConns()Concurrent stream ceiling a manager enforces; see PROP_MAX_STREAMS.- Returns:
- the max concurrent streams
isAccessListEnabled
public boolean isAccessListEnabled()Whether the access list is enabled.- Returns:
- whether access list enabled
isBlacklistEnabled
public boolean isBlacklistEnabled()Whether the blacklist is enabled.- Returns:
- whether blacklist enabled
getAccessList
getBlacklist
Destinations refused outright, consulted when blacklisting is enabled.- Returns:
- the set as held, without copying; null unless
isBlacklistEnabled()is true
getLimitAction
"reset", "drop", "http", or custom string; default "reset" @since 0.9.34.- Returns:
- the action taken when a connection limit is exceeded
getTagsToSend
public int getTagsToSend()Mostly handled on router side; PacketQueue needs to know for override limits @since 0.9.34.- Returns:
- the number of ElGamal tags to send
getTagThreshold
public int getTagThreshold()Tag count below which the session is considered tag-short.- Returns:
- the tag count below which the session is considered tag-short
initLists
Copy the access/blacklist sets and their enable flags from another instance.- Parameters:
opts- source of the lists to share
initLists
Build the access/blacklist sets from a comma, semicolon or space separatedPROP_ACCESS_LIST, logging and skipping unparseable entries.- Parameters:
opts- properties to read the enable flags and hash list from
error
Log an error message against the ConnectionOptions log.- Parameters:
s- message describing the problem
toString
getMaxInboundBufferStatic
public static int getMaxInboundBufferStatic()Maximum inbound buffer cap, tunable via Tuner.- Returns:
- the inbound buffer cap in bytes
setMaxInboundBufferStatic
public static void setMaxInboundBufferStatic(int val) Maximum inbound buffer cap, clamped to [512KB, 64MB].- Parameters:
val- the inbound buffer cap in bytes
initializeInboundBufferSize
private void initializeInboundBufferSize()Initialize inbound buffer size and packet count cap.getBool
Parse a boolean property from opts.- Parameters:
opts- properties to read from, may be nullname- property key to look updefaultVal- fallback when opts is null or the key is absent- Returns:
- the parsed flag, or defaultVal if unset; anything
Boolean.parseBoolean(String)does not read as true is false