1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00

Paged SyncState, Added Ping, Required ALPN on the server, Capped retention ages, Closed idle database connections

- Protocol 8: SyncStateRequest takes `after` (a Pair), SyncState has
  `more` and 32768 heads at most (MAX_HEADS_PER_PACKET), the lists and
  missing attachments in the first page only; heads_after in storage,
  both ends of replication read in pages (step 17)
- Protocol 8: Ping / Pong (19, 20) keep an idle connection open
  (IDLE_TIMEOUT_SECS 300, KEEPALIVE_SECS 60). Client::ping,
  BakaShrot_Ping, Python ping(), C# Ping(), the PureBasic prototype; the
  tool's --follow, Python's follow(), C#'s Follow() and the replication
  links ping every minute while waiting longer, so sync_interval over
  5 min works now (dropped from known-issues.md)
- The server closes a client offering no ALPN right after TLS: rustls
  only refused one offering other protocols
- Retention ages are 100 years at most (MAX_RETENTION_AGE); the cutoff
  is computed once, saturating (Retention::cutoff): a huge age wrapped
  around to almost nothing in milliseconds
- [server] idle_database_connections (8 by default, 0-512): the idle
  read and query connections each pool keeps, those unused for a minute
  closed by a sweeping thread
- Tests for each, docs, the C header, revamp.md (step 18)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 23:19:58 +01:00
parent c513d8bf05
commit 6fae7e61c9
34 changed files with 1066 additions and 164 deletions
-12
View File
@@ -61,13 +61,6 @@ network**, not exposed to the internet. So:
From a read of the source on 2026-11-15: no test shows any of these yet.
Reproduce one before fixing it, and move it up (or drop it) once known.
- **`sync_interval` over 5 min.** The server dialed closes the idle link
(`IDLE_TIMEOUT`), so every check-in fails once ("closed the link",
warned), then the link is dialed again after `retry_delay`. Nothing
in the config caps `sync_interval`. Left as it is (the owner,
2026-11-16): replicating every 5 min or more isn't a real use, the
example config says to keep it under. Fix if needed: cap it under the
idle timeout, or have an idle link ask its `SyncState` more often.
- **Resuming a big replicated attachment.** Before answering `Continue`,
the receiver reads back and hashes every part it already has
(`accept_from.rs`, `replicate_attachment`, `hash_parts`), while the
@@ -79,11 +72,6 @@ Reproduce one before fixing it, and move it up (or drop it) once known.
the example config says so by `max_attachment_size` (1 GiB by
default). Fix if needed: a wait scaled to the parts already received,
or the hash's state kept with the attachment.
- **`SyncState` in one packet.** Every head the peer may
send goes in one frame of 16 MiB at most: with very many topic and
node pairs (hundreds of thousands) it doesn't fit, the packet can't
be sent and replication stops. Fix: heads in several packets, or only
those that changed.
- **Peers with several roles.** `SyncState` lists the union of its
roles' `accept_topics` and the union of their `accept_nodes`
(`Permissions::accepted`), while what's taken is each role on its