net.i2p.client.streaming
Class ConnectionOptions

java.lang.Object
  extended by net.i2p.client.streaming.I2PSocketOptionsImpl
      extended by net.i2p.client.streaming.ConnectionOptions
All Implemented Interfaces:
I2PSocketOptions

public class ConnectionOptions
extends I2PSocketOptionsImpl

Define the current options for the con (and allow custom tweaking midstream)


Field Summary
(package private) static int DEFAULT_MAX_SENDS
           
static int INACTIVITY_ACTION_DISCONNECT
          on inactivity timeout, close the connection
static int INACTIVITY_ACTION_NOOP
          on inactivity timeout, do nothing
static int INACTIVITY_ACTION_SEND
          on inactivity timeout, send a payload message
(package private) static int INITIAL_WINDOW_SIZE
           
(package private) static int MIN_WINDOW_SIZE
           
static int PROFILE_BULK
           
static int PROFILE_INTERACTIVE
           
static java.lang.String PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR
           
static java.lang.String PROP_CONNECT_DELAY
           
static java.lang.String PROP_INACTIVITY_ACTION
           
static java.lang.String PROP_INACTIVITY_TIMEOUT
           
static java.lang.String PROP_INITIAL_ACK_DELAY
           
static java.lang.String PROP_INITIAL_RECEIVE_WINDOW
           
static java.lang.String PROP_INITIAL_RESEND_DELAY
           
static java.lang.String PROP_INITIAL_RTT
           
static java.lang.String PROP_INITIAL_WINDOW_SIZE
           
static java.lang.String PROP_MAX_MESSAGE_SIZE
           
static java.lang.String PROP_MAX_RESENDS
           
static java.lang.String PROP_MAX_WINDOW_SIZE
           
static java.lang.String PROP_PROFILE
           
static java.lang.String PROP_SLOW_START_GROWTH_RATE_FACTOR
           
 
Fields inherited from class net.i2p.client.streaming.I2PSocketOptionsImpl
DEFAULT_BUFFER_SIZE, DEFAULT_CONNECT_TIMEOUT, DEFAULT_WRITE_TIMEOUT
 
Fields inherited from interface net.i2p.client.streaming.I2PSocketOptions
PROP_BUFFER_SIZE, PROP_CONNECT_TIMEOUT, PROP_READ_TIMEOUT, PROP_WRITE_TIMEOUT
 
Constructor Summary
ConnectionOptions()
           
ConnectionOptions(ConnectionOptions opts)
           
ConnectionOptions(I2PSocketOptions opts)
           
ConnectionOptions(java.util.Properties opts)
           
 
Method Summary
 int getChoke()
          how long we want to wait before any data is transferred on the connection in either direction
 int getCongestionAvoidanceGrowthRateFactor()
          When we're in congestion avoidance, we grow the window size at the rate of 1/(windowSize*factor).
 int getConnectDelay()
          how long will we wait after instantiating a new con before actually attempting to connect.
 int getInactivityAction()
           
 int getInactivityTimeout()
          What period of inactivity qualifies as "too long"?
 int getInboundBufferSize()
          how much data are we willing to accept in our buffer?
 int getMaxMessageSize()
          What is the largest message we want to send or receive?
 int getMaxResends()
          How many times will we try to send a message before giving up?
 int getMaxWindowSize()
           
 int getProfile()
          What profile do we want to use for this connection?
 int getReceiveWindow()
          after how many consecutive messages should we ack?
 boolean getRequireFullySigned()
          Do we want all packets in both directions to be signed, or can we deal with signatures on the SYN and FIN packets only?
 int getResendDelay()
          How long after sending a packet will we wait before resending?
 int getRTO()
           
 int getRTT()
          What to set the round trip time estimate to (in milliseconds)
 int getRTTTrend()
          If we have 3 consecutive rtt increases, we are trending upwards (1), or if we have 3 consecutive rtt decreases, we are trending downwards (-1), else we're stable.
 int getSendAckDelay()
          if there are packets we haven't ACKed yet and we don't receive _receiveWindow messages before (_lastSendTime+_sendAckDelay), send an ACK of what we have received so far.
 int getSlowStartGrowthRateFactor()
          When we're in slow start, we grow the window size at the rate of 1/(factor).
 int getWindowSize()
          How many messages will we send before waiting for an ACK?
protected  void init(java.util.Properties opts)
           
static void main(java.lang.String[] args)
           
 void setChoke(int ms)
           
 void setCongestionAvoidanceGrowthRateFactor(int factor)
           
 void setConnectDelay(int delayMs)
           
 void setInactivityAction(int action)
           
 void setInactivityTimeout(int timeout)
           
 void setInboundBufferSize(int bytes)
           
 void setMaxMessageSize(int bytes)
           
 void setMaxResends(int numSends)
           
 void setMaxWindowSize(int msgs)
           
 void setProfile(int profile)
           
 void setProperties(java.util.Properties opts)
           
 void setReceiveWindow(int numMsgs)
           
 void setRequireFullySigned(boolean sign)
           
 void setResendDelay(int ms)
           
 void setRTT(int ms)
           
 void setSendAckDelay(int delayMs)
           
 void setSlowStartGrowthRateFactor(int factor)
           
 void setWindowSize(int numMsgs)
           
 java.lang.String toString()
           
 void updateRTT(int measuredValue)
           
 
Methods inherited from class net.i2p.client.streaming.I2PSocketOptionsImpl
getConnectTimeout, getInt, getMaxBufferSize, getReadTimeout, getWriteTimeout, setConnectTimeout, setMaxBufferSize, setReadTimeout, setWriteTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROFILE_BULK

public static final int PROFILE_BULK
See Also:
Constant Field Values

PROFILE_INTERACTIVE

public static final int PROFILE_INTERACTIVE
See Also:
Constant Field Values

INACTIVITY_ACTION_NOOP

public static final int INACTIVITY_ACTION_NOOP
on inactivity timeout, do nothing

See Also:
Constant Field Values

INACTIVITY_ACTION_DISCONNECT

public static final int INACTIVITY_ACTION_DISCONNECT
on inactivity timeout, close the connection

See Also:
Constant Field Values

INACTIVITY_ACTION_SEND

public static final int INACTIVITY_ACTION_SEND
on inactivity timeout, send a payload message

See Also:
Constant Field Values

PROP_CONNECT_DELAY

public static final java.lang.String PROP_CONNECT_DELAY
See Also:
Constant Field Values

PROP_PROFILE

public static final java.lang.String PROP_PROFILE
See Also:
Constant Field Values

PROP_MAX_MESSAGE_SIZE

public static final java.lang.String PROP_MAX_MESSAGE_SIZE
See Also:
Constant Field Values

PROP_MAX_RESENDS

public static final java.lang.String PROP_MAX_RESENDS
See Also:
Constant Field Values

PROP_INITIAL_RTT

public static final java.lang.String PROP_INITIAL_RTT
See Also:
Constant Field Values

PROP_INITIAL_RESEND_DELAY

public static final java.lang.String PROP_INITIAL_RESEND_DELAY
See Also:
Constant Field Values

PROP_INITIAL_ACK_DELAY

public static final java.lang.String PROP_INITIAL_ACK_DELAY
See Also:
Constant Field Values

PROP_INITIAL_WINDOW_SIZE

public static final java.lang.String PROP_INITIAL_WINDOW_SIZE
See Also:
Constant Field Values

PROP_INITIAL_RECEIVE_WINDOW

public static final java.lang.String PROP_INITIAL_RECEIVE_WINDOW
See Also:
Constant Field Values

PROP_INACTIVITY_TIMEOUT

public static final java.lang.String PROP_INACTIVITY_TIMEOUT
See Also:
Constant Field Values

PROP_INACTIVITY_ACTION

public static final java.lang.String PROP_INACTIVITY_ACTION
See Also:
Constant Field Values

PROP_MAX_WINDOW_SIZE

public static final java.lang.String PROP_MAX_WINDOW_SIZE
See Also:
Constant Field Values

PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR

public static final java.lang.String PROP_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR
See Also:
Constant Field Values

PROP_SLOW_START_GROWTH_RATE_FACTOR

public static final java.lang.String PROP_SLOW_START_GROWTH_RATE_FACTOR
See Also:
Constant Field Values

INITIAL_WINDOW_SIZE

static final int INITIAL_WINDOW_SIZE
See Also:
Constant Field Values

DEFAULT_MAX_SENDS

static final int DEFAULT_MAX_SENDS
See Also:
Constant Field Values

MIN_WINDOW_SIZE

static final int MIN_WINDOW_SIZE
See Also:
Constant Field Values
Constructor Detail

ConnectionOptions

public ConnectionOptions()

ConnectionOptions

public ConnectionOptions(java.util.Properties opts)

ConnectionOptions

public ConnectionOptions(I2PSocketOptions opts)

ConnectionOptions

public ConnectionOptions(ConnectionOptions opts)
Method Detail

init

protected void init(java.util.Properties opts)
Overrides:
init in class I2PSocketOptionsImpl

setProperties

public void setProperties(java.util.Properties opts)
Overrides:
setProperties in class I2PSocketOptionsImpl

getConnectDelay

public int getConnectDelay()
how long will we wait after instantiating a new con before actually attempting to connect. If this is set to 0, connect ASAP. If it is greater than 0, wait until the output stream is flushed, the buffer fills, or that many milliseconds pass.


setConnectDelay

public void setConnectDelay(int delayMs)

getRequireFullySigned

public boolean getRequireFullySigned()
Do we want all packets in both directions to be signed, or can we deal with signatures on the SYN and FIN packets only?


setRequireFullySigned

public void setRequireFullySigned(boolean sign)

getWindowSize

public int getWindowSize()
How many messages will we send before waiting for an ACK?


setWindowSize

public void setWindowSize(int numMsgs)

getReceiveWindow

public int getReceiveWindow()
after how many consecutive messages should we ack?


setReceiveWindow

public void setReceiveWindow(int numMsgs)

getRTT

public int getRTT()
What to set the round trip time estimate to (in milliseconds)


setRTT

public void setRTT(int ms)

getRTO

public int getRTO()

getRTTTrend

public int getRTTTrend()
If we have 3 consecutive rtt increases, we are trending upwards (1), or if we have 3 consecutive rtt decreases, we are trending downwards (-1), else we're stable.


updateRTT

public void updateRTT(int measuredValue)

getResendDelay

public int getResendDelay()
How long after sending a packet will we wait before resending?


setResendDelay

public void setResendDelay(int ms)

getSendAckDelay

public int getSendAckDelay()
if there are packets we haven't ACKed yet and we don't receive _receiveWindow messages before (_lastSendTime+_sendAckDelay), send an ACK of what we have received so far.


setSendAckDelay

public void setSendAckDelay(int delayMs)

getMaxMessageSize

public int getMaxMessageSize()
What is the largest message we want to send or receive?


setMaxMessageSize

public void setMaxMessageSize(int bytes)

getChoke

public int getChoke()
how long we want to wait before any data is transferred on the connection in either direction


setChoke

public void setChoke(int ms)

getProfile

public int getProfile()
What profile do we want to use for this connection?


setProfile

public void setProfile(int profile)

getMaxResends

public int getMaxResends()
How many times will we try to send a message before giving up?


setMaxResends

public void setMaxResends(int numSends)

getInactivityTimeout

public int getInactivityTimeout()
What period of inactivity qualifies as "too long"?


setInactivityTimeout

public void setInactivityTimeout(int timeout)

getInactivityAction

public int getInactivityAction()

setInactivityAction

public void setInactivityAction(int action)

getMaxWindowSize

public int getMaxWindowSize()

setMaxWindowSize

public void setMaxWindowSize(int msgs)

getInboundBufferSize

public int getInboundBufferSize()
how much data are we willing to accept in our buffer?


setInboundBufferSize

public void setInboundBufferSize(int bytes)

getCongestionAvoidanceGrowthRateFactor

public int getCongestionAvoidanceGrowthRateFactor()
When we're in congestion avoidance, we grow the window size at the rate of 1/(windowSize*factor). In standard TCP, window sizes are in bytes, while in I2P, window sizes are in messages, so setting factor=maxMessageSize mimics TCP, but using a smaller factor helps grow a little more rapidly.


setCongestionAvoidanceGrowthRateFactor

public void setCongestionAvoidanceGrowthRateFactor(int factor)

getSlowStartGrowthRateFactor

public int getSlowStartGrowthRateFactor()
When we're in slow start, we grow the window size at the rate of 1/(factor). In standard TCP, window sizes are in bytes, while in I2P, window sizes are in messages, so setting factor=maxMessageSize mimics TCP, but using a smaller factor helps grow a little more rapidly.


setSlowStartGrowthRateFactor

public void setSlowStartGrowthRateFactor(int factor)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)