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:
@@ -301,6 +301,26 @@ namespace NibblePoker.BakaShrot.Tests
|
||||
Assert.That(kitchen.Connected, Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnswerTimeouts()
|
||||
{
|
||||
const string forever =
|
||||
"WITH RECURSIVE n(i) AS (SELECT 1 UNION ALL SELECT i + 1 FROM n) SELECT count(*) FROM n";
|
||||
using Client kitchen = Server.Connect("kitchen");
|
||||
Assert.That(kitchen.AnswerTimeoutMs, Is.EqualTo(Client.DefaultAnswerTimeoutMs));
|
||||
BakaShrotException refused = Assert.Throws<BakaShrotException>(() => kitchen.AnswerTimeoutMs = 0)!;
|
||||
Assert.That(refused.Code, Is.EqualTo(ErrorCode.InvalidArgument));
|
||||
kitchen.AnswerTimeoutMs = 300;
|
||||
Assert.That(kitchen.Connected, Is.True, "set while connected");
|
||||
ConnectionLostException lost = Assert.Throws<ConnectionLostException>(() => kitchen.Query(forever))!;
|
||||
Assert.That(lost.Code, Is.EqualTo(ErrorCode.ConnectionLost));
|
||||
Assert.That(kitchen.Connected, Is.False);
|
||||
kitchen.Connect();
|
||||
Assert.That(kitchen.AnswerTimeoutMs, Is.EqualTo(300), "kept across connections");
|
||||
lost = Assert.Throws<ConnectionLostException>(() => kitchen.Query(forever))!;
|
||||
Assert.That(lost.Code, Is.EqualTo(ErrorCode.ConnectionLost));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Connecting()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user