java.lang.Object
net.i2p.util.SimpleTimer2.TimedEvent
net.i2p.client.streaming.impl.ConnectionHandler.SynReaper
All Implemented Interfaces:
Runnable
Enclosing class:
ConnectionHandler

private class ConnectionHandler.SynReaperextends SimpleTimer2.TimedEvent
Periodic reaper that removes SYN packets from the accept queue after their accept timeout has elapsed, sending a reset if it was a SYN.

Replaces two per-SYN TimedEvents (one at enqueue in ConnectionHandler.receiveNewSyn(Packet), one at dequeue in the accept worker) with a single self-rescheduling event that scans the enqueue table every ConnectionHandler.SYN_SWEEP_INTERVAL. Under a SYN flood the old model posted O(n) timer events per second. This is O(1) posts per second regardless of load. The time-between-sweeps bound means a SYN may persist at most one interval past its timeout — negligible against 10s+ accept timeouts.

The two-argument removal on the concurrent map is atomic against the worker's refresh, so a packet that was re-quoted after this sweep read its entry is left alone for the next sweep.

  • Constructor Details

    • SynReaper

      SynReaper()
      Builds the half open connection reaper.
  • Method Details

    • timeReached

      public void timeReached()
      Description copied from class: SimpleTimer2.TimedEvent
      Called when this event's scheduled time arrives. Must NOT block. For periodic events, call schedule(period) at the end to self-reschedule.
      Specified by:
      timeReached in class SimpleTimer2.TimedEvent