Class ConnectionConfig.Builder

java.lang.Object
org.drasyl.handler.connection.ConnectionConfig.Builder
Enclosing class:
ConnectionConfig

public abstract static class ConnectionConfig.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • unusedPortSupplier

      public abstract ConnectionConfig.Builder unusedPortSupplier(IntSupplier unusedPortSupplier)
    • issSupplier

      public abstract ConnectionConfig.Builder issSupplier(LongSupplier issSupplier)
      Used to choose an initial send sequence number. A random number within [0,4294967296] is chosen by default.
    • sndBufSupplier

      public abstract ConnectionConfig.Builder sndBufSupplier(Function<io.netty.channel.Channel,SendBuffer> sndBufSupplier)
      Used to create the SendBuffer.
    • rtnsQSupplier

      public abstract ConnectionConfig.Builder rtnsQSupplier(Function<io.netty.channel.Channel,RetransmissionQueue> rtnsQSupplier)
      Used to create the RetransmissionQueue.
    • rcfBufSupplier

      public abstract ConnectionConfig.Builder rcfBufSupplier(Supplier<ReceiveBuffer> rcfBufSupplier)
      Used to create the ReceiveBuffer.
    • tcbSupplier

      public abstract ConnectionConfig.Builder tcbSupplier(BiFunction<ConnectionConfig,io.netty.channel.Channel,TransmissionControlBlock> tcbProvider)
      Used to create the TransmissionControlBlock.
    • activeOpen

      public abstract ConnectionConfig.Builder activeOpen(boolean activeOpen)
      If enabled, a handshake will be issued on ChannelInboundHandler.channelActive(ChannelHandlerContext). Otherwise, the remote peer must initiate the handshake.
    • rmem

      public abstract ConnectionConfig.Builder rmem(int rmem)
      Defines the receive buffer size (rmem). Refers to the amount of memory allocated on the receiving side of a connection to temporarily store incoming data before it's processed by the application. Increasing the buffer size can improve network performance by reducing the likelihood of packet loss due to buffer overflow. However, it can also increase memory usage on the receiving side and may not always result in significant performance gains. Set to 65535 bytes by default.
    • msl

      public abstract ConnectionConfig.Builder msl(Duration msl)
      The maximum segment lifetime, the time a segment can exist in the network. According to RFC 9293, arbitrarily defined to be 2 minutes by default.
    • noDelay

      public abstract ConnectionConfig.Builder noDelay(boolean noDelay)
      If enabled, small data packets are sent without delay, instead of waiting for larger packets to be filled. Disabling can reduce latency and improve the responsiveness of real-time applications, but may increase the overall network traffic.
      See Also:
    • overrideTimeout

      public abstract ConnectionConfig.Builder overrideTimeout(Duration overrideTimeout)
      Defines how long small data packets are delayed at most. According to RFC 9293, the override timeout should be in the range 0.1 - 1.0 seconds. Default value is 0.1 seconds.
      See Also:
    • fs

      public abstract ConnectionConfig.Builder fs(double fs)
      A constant used by the Nagle algorithm. Recommended value is 1/2. The default is set to this recommendation
      See Also:
    • userTimeout

      public abstract ConnectionConfig.Builder userTimeout(Duration userTimeout)
      Defines the duration how long a connection waits for sent data to be acknowledged before the connection is closed.
    • timestamps

      public abstract ConnectionConfig.Builder timestamps(boolean timestamps)
      Enables the Timestamps option which is used for round-trip time measurements. Used to arrive a reasonable value for the retransmission timeout. If disabled, the timeout specified by rto(Duration) is used. Enabled by default.
      See Also:
    • rto

      public abstract ConnectionConfig.Builder rto(Duration rto)
      The retransmission timeout (RTO) is the amount of time that a connection waits before retransmitting a packet that has not been acknowledged.
      See Also:
    • lBound

      public abstract ConnectionConfig.Builder lBound(Duration lBound)
      The minimum value allowed for the retransmission timeout. This is 1 second by default. If timestamps(boolean) is disabled, this value is used as static retransmission timeout.
      See Also:
    • uBound

      public abstract ConnectionConfig.Builder uBound(Duration uBound)
      The maximum value allowed for the retransmission timeout. This is 1 minute by default.
      See Also:
    • alpha

      public abstract ConnectionConfig.Builder alpha(double alpha)
      The ALPHA smoothing factor used for congestion control algorithm to calculate the current congestion window size. It determines the weight given to new data when estimating the network's bandwidth.

      A higher value for the ALPHA parameter leads to more aggressive growth of the congestion window and can result in higher throughput but may also cause more congestion in the network. A lower value for the ALPHA parameter can help to reduce congestion but may also lead to lower throughput.

      According to RFC 6298, a value of 1/8 is suggested. The default is set to this suggestion.

      See Also:
    • beta

      public abstract ConnectionConfig.Builder beta(double beta)
      The BETA delay variance factor is used in congestion control algorithm. It's used to adjust the rate at which the congestion window size is decreased when packets are lost or delayed.

      A higher value for the BETA parameter can cause the connection to be more aggressive in reducing the congestion window, which can help to prevent congestion but may also lead to reduced throughput. A lower value for the BETA parameter can result in less aggressive reduction of the congestion window, which can lead to higher throughput but may also cause more congestion in the network.

      According to RFC 6298, a value of 1/4 is suggested. The default is set to this suggestion.

      See Also:
    • k

      public abstract ConnectionConfig.Builder k(int k)
      The K constant is used to scale the RTT variance to calculate the retransmission timeout.

      According to RFC 6298, a value of 4 is suggested. The default is set to this suggestion.

      See Also:
    • clock

      public abstract ConnectionConfig.Builder clock(ConnectionConfig.Clock clock)
      Defines the clock used as time source.
    • mmsS

      public abstract ConnectionConfig.Builder mmsS(int mmsS)
      The maximum segment size for a drasyl-layer message that a connection may send. This value is the IP layer MTU (drasyl assumes a MTU of 1460) minus the drasyl header size. So this value specifies the segment size sent to the wire (including header).
      See Also:
    • mmsR

      public abstract ConnectionConfig.Builder mmsR(int mmsR)
      The maximum size for a drasyl-layer message that can be received. This value is the IP layer MTU (drasyl assumes a MTU of 1460) minus the drasyl header size. So this value specifies the segment size sent to the wire (including header).
      See Also:
    • build

      public ConnectionConfig build()