java.lang.Object
net.i2p.client.streaming.impl.SchedulerImpl
net.i2p.client.streaming.impl.SchedulerConnecting
All Implemented Interfaces:
TaskScheduler

class SchedulerConnectingextends SchedulerImpl

Scheduler used once we've sent our SYN but it hasn't been ACKed yet. This connection may or may not be locally created.

Entry conditions:

  • Packets sent but none ACKed

Events:

  • Packets received (which may or may not ACK the ones sent)
  • Message flush (explicitly, through a full buffer, or stream closure)
  • Connection establishment timeout
  • RESET received

Next states:

  • connected - after receiving an ACK
  • closing - after both sending and receiving a CLOSE
  • closed - after both sending and receiving ACKs on the CLOSE
  • dead - after sending or receiving a RESET
  • Constructor Details

    • SchedulerConnecting

      public SchedulerConnecting(I2PAppContext ctx)
      Passes the context on to the shared scheduler base.
      Parameters:
      ctx - the I2P app context supplying the clock and logger
  • Method Details

    • accept

      public boolean accept(Connection con)
      Accept connections where the SYN has been sent but not yet ACKed.
      Parameters:
      con - the connection to check
      Returns:
      true if the connection is in the connecting state
    • eventOccurred

      public void eventOccurred(Connection con)
      Handle an event on a connecting connection. Checks for connect timeout and sends available data when the send time arrives.

      The timeout gate uses the connection's effective connect window (Connection.getEffectiveConnectWindow()) rather than the raw un-scaled connectTimeout. That window is the (connectDelay + connectTimeout) base scaled by the Tuner's connect-timeout multiplier, the same budget waitForConnect(int) and the SYN give-up check in Connection#getMaxSynSends() use, so this scheduler can never tear an unacknowledged SYN down before those render the accurate "Connection timed out: SYN not acknowledged" error. As a last-resort backstop it defers to an error that already fired and only sets its own generic message when none is present. A window of 0 means no connect timeout is configured, in which case this scheduler does not give up on its own.

      Parameters:
      con - the connection that had an event