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
@@ -62,6 +62,7 @@ PrototypeC.i BakaShrot_SetCrl_Prototype(Client.q, Crl.p-unicode)
PrototypeC.i BakaShrot_Connect_Prototype(Client.q, Host.p-unicode, Port.l)
PrototypeC.i BakaShrot_IsConnected_Prototype(Client.q)
PrototypeC.i BakaShrot_Disconnect_Prototype(Client.q)
PrototypeC.i BakaShrot_Ping_Prototype(Client.q)
PrototypeC.i BakaShrot_GetNode_Prototype(Client.q, *Buffer, BufferSize.i)
PrototypeC.q BakaShrot_PushMessageTo_Prototype(Client.q, Topic.p-unicode, JsonData.p-unicode)
PrototypeC.i BakaShrot_GetLatestMessageOf_Prototype(Client.q, Topic.p-unicode, Node.p-unicode)
@@ -112,6 +113,7 @@ Global BakaShrot_SetCrl.BakaShrot_SetCrl_Prototype
Global BakaShrot_Connect.BakaShrot_Connect_Prototype
Global BakaShrot_IsConnected.BakaShrot_IsConnected_Prototype
Global BakaShrot_Disconnect.BakaShrot_Disconnect_Prototype
Global BakaShrot_Ping.BakaShrot_Ping_Prototype
Global BakaShrot_GetNode.BakaShrot_GetNode_Prototype
Global BakaShrot_PushMessageTo.BakaShrot_PushMessageTo_Prototype
Global BakaShrot_GetLatestMessageOf.BakaShrot_GetLatestMessageOf_Prototype
@@ -199,6 +201,7 @@ Procedure.i BakaShrot_LoadClient(DllPath.s)
BakaShrot_Connect = BakaShrot_ClientFunction("BakaShrot_ConnectW")
BakaShrot_IsConnected = BakaShrot_ClientFunction("BakaShrot_IsConnected")
BakaShrot_Disconnect = BakaShrot_ClientFunction("BakaShrot_Disconnect")
BakaShrot_Ping = BakaShrot_ClientFunction("BakaShrot_Ping")
BakaShrot_GetNode = BakaShrot_ClientFunction("BakaShrot_GetNodeW")
BakaShrot_PushMessageTo = BakaShrot_ClientFunction("BakaShrot_PushMessageToW")
BakaShrot_GetLatestMessageOf = BakaShrot_ClientFunction("BakaShrot_GetLatestMessageOfW")