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

Stopped long queries, Read is_open() through TLS, Simplified answers and paging

- [server] query_time_limit (20 s by default) stops a client's query
  through SQLite's progress handler: refused with QueryTimedOut (11). A
  client closing while its query runs stops it too.
- The answer timeout in the DLL (BakaShrot_SetAnswerTimeout /
  GetAnswerTimeout, kept across connections), Python (answer_timeout)
  and C# (AnswerTimeoutMs); QueryTimedOut in every binding.
- is_open() reads what's waiting through TLS: a close_notify says
  closed, TLS's own records keep it open, unasked data or a broken
  stream close it.
- The Rust client checks an answer's type in one place (TryFrom per
  packet); Client::wait() pings while waiting (the tool's --follow).
- Pair::from(&Head), heads_after taking a Pair; simpler SyncState
  paging on both ends; the writer's redundant rollback check dropped.
- codes.rs: the bindings' error codes and copied values match Rust's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 12:17:28 +01:00
parent a6ade535d0
commit 1bae8ee182
37 changed files with 1064 additions and 264 deletions
+8 -1
View File
@@ -184,7 +184,8 @@ the same ids with different messages, undetected.
| TLS, versions, welcome | 10 s (the server); the client's connect too |
| Silence between requests | 5 min, then the server closes (a `Ping` is a request: links and follows send one every minute while they wait) |
| A packet sent (an answer, an attachment's part, to a peer too) | 30 s (the server), then it closes: a client that stopped reading doesn't hold a connection |
| An answer | 30 s (the client) |
| An answer | 30 s (the client; `set_answer_timeout()`, `BakaShrot_SetAnswerTimeout()`), then it closes: the server stops the query it was running |
| A query | 20 s (`[server] query_time_limit`), then SQLite stops it: `QueryTimedOut` |
| An attachment's next part | 30 s (the server), then it closes |
## Requests so far
@@ -232,6 +233,10 @@ the same ids with different messages, undetected.
refused with SQLite's message (`QueryFailed`, with a hint to add
`is_json = 1` on "malformed JSON"), over 10,000 rows or 16 MB
(`TooBig`), never a partial result (`storage.md`, "The query surface").
Stopped past `query_time_limit` (`QueryTimedOut`, "stopped after 20s,
the server's time limit"), or when the client closes meanwhile (it
gave up): its thread isn't left running. `Server::queries_running()`
says how many run.
- **Sizes:** frames up to 16 MB (`MAX_PACKET_SIZE`), a bigger one drops the
connection; messages up to `MAX_MESSAGE_SIZE` (16 MB less 4 KB), the
server refusing bigger ones (`TooBig`); the client refuses messages and
@@ -358,6 +363,8 @@ each:
part on, something else than a part (closed, dropped);
- queries: not allowed, results, a non-JSON row
refused with the hint, errors, writes and two statements refused;
one past `query_time_limit` refused, the connection kept; one whose
client gave up first stopped (`queries_are_stopped`);
- refusals keeping the connection (not allowed, unknown topic, a bad name
the client catches);
- certificates refused (no known role, with why; another CA's client; a