- 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 TypeMethodDescriptionSupply the connection an empty or truncated response is retried on.default I2PSocket[]reconnectPair(Exception cause) Open one or two sockets for an empty-response retry.default voidRelease any per-dest permit held for a dual-race's secondary socket.
Method Details
reconnect
reconnectPair
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 viareconnect(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.