Skip to content

harden(l1): refuse every connection while the borrowed site is down (H8) - #3

Open
croc100 wants to merge 1 commit into
mainfrom
harden/h8-refuse-when-site-unreachable
Open

croc100 wants to merge 1 commit into
mainfrom
harden/h8-refuse-when-site-unreachable

Conversation

@croc100

@croc100 croc100 commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Closes ROADMAP H8 — silent failure when the borrowed site is unreachable.

Problem

When the borrowed site stopped answering, the splice's dial failed and the relay closed with a FIN after accepting the connection and swallowing a ClientHello. Meanwhile Warren clients kept being served, so one relay address had two behaviours: some connections became long TLS sessions, every other one got nothing. That is separable with no key.

Change

  • warmpool.go: the pool keeps a reachability verdict from its dials. siteDownAfter (2) consecutive failures, from the background filler or a splice's fresh dial, mark the site down. Any success brings it back. Dials abandoned on shutdown are not counted.
  • camouflage.go:
    • While the site is down, serveConn resets every new connection before reading, Warren clients included.
    • A splice whose dial fails now resets instead of closing with a FIN.
    • New resetClose helper.
  • The filler keeps dialing every refill tick, so the relay recovers on its own within a few seconds.

Known residuals (documented in ROADMAP/CHANGELOG)

  • A reset after accept is still distinguishable from a refused port. Closing the listener would fix that, but Serve doesn't own it (API change, out of scope here).
  • A site that accepts TCP but rejects the relay at TLS (DESIGN §15) still reads as reachable.

Tests (sitedown_test.go)

  • Reachability verdict: one failure is tolerated, two mark the site down, a success recovers it, shutdown dials are ignored.
  • A splice whose dial fails ends in a reset.
  • End to end: a relay with a dead site resets both a probe and a genuine Warren client, then serves again once the site comes back.

Both behaviour tests were checked against the fix reverted and fail. The splice test first passed for the wrong reason: closing a socket with unread data makes the kernel RST on its own. It now consumes the request first, like serveConn's peek.

Locally (Windows): go build, go vet, go test ./... and LF-normalised gofmt all pass. -race is not available here, so CI covers it.

🤖 Generated with Claude Code

When the borrowed site stopped answering, the splice closed with a FIN after
swallowing a ClientHello, while Warren clients went on being served: one address
with two behaviours, separable with no key.

The warm pool now keeps a reachability verdict from its dials (two consecutive
failures mark the site down, any success brings it back). While the site is
down, serveConn resets every new connection before reading, Warren clients
included, and a splice whose dial fails resets instead of closing cleanly. The
background filler keeps dialing, so the relay recovers without a restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant