Enclosing class:
I2PTunnelRunner

public static interface I2PTunnelRunner.ReconnectCallback
Callback for reconnecting via a second route when the first attempt completes with zero upstream bytes, or dies mid-body with an incomplete Content-Length response (Range resume).

Used by the HTTP client proxy to transparently retry an idempotent GET/HEAD against a fresh I2P connection (a new tunnel) without tearing down the browser socket (a silent zero-byte close becomes NS_ERROR_NET_EMPTY_RESPONSE for the browser. A mid-body death would truncate a download). The runner keeps the local socket open across attempts; the callback supplies each new connection (or null to stop).

  • Method Summary

    Modifier and Type
    Method
    Description
    Supply the connection an empty or truncated response is retried on.
    default I2PSocket[]
    Open one or two sockets for an empty-response retry.
    default void
    Release any per-dest permit held for a dual-race's secondary socket.
  • Method Details

    • reconnect

      I2PSocket reconnect(Exception cause)
      Supply the connection an empty or truncated response is retried on.
      Parameters:
      cause - the cause of the empty or mid-body completion, or null
      Returns:
      a freshly connected I2P socket to retry on, or null to give up
    • reconnectPair

      default I2PSocket[] reconnectPair(Exception cause)
      Open one or two sockets for an empty-response retry. Two sockets are raced by the runner (first response byte wins) so a dest that black-holes one tunnel path still recovers on the alternate. The default opens a single socket via reconnect(Exception) so existing callbacks keep working unchanged.
      Parameters:
      cause - the cause of the empty completion, or null
      Returns:
      1–2 freshly connected sockets (index 0 is primary), or null to give up
    • releaseRacePermit

      default void releaseRacePermit()
      Release any per-dest permit held for a dual-race's secondary socket. Called by the runner as soon as the race settles (winner chosen or both legs failed) so the extra permit is not held for the download. Default no-op for single-socket callbacks.