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

Kept attachments whose read-back failed, Closed the Rust client's connection when out of step

- Replication: a peer's DataMismatch has the sender read its own copy
  back. Dropped as damaged only when read whole and not matching, or a
  part missing; a read-back that failed otherwise (a busy database, a
  connection not opened) dropped it too, the only copy if this server
  was its origin: now kept and warned about (push_to.rs, judge)
- bakashrot-client: an I/O error, a timeout, an answer that isn't the
  request's or doesn't decode, parts cut short or interrupted, a source
  failing mid-upload close the connection; requests after fail with
  NotConnected without reading, so a late answer is never taken for
  the next request's (a push could return the previous one's id).
  is_closed(), set_answer_timeout() / answer_timeout() (30 s by
  default), is_open() always blocking again
- The DLL forgets a client its connection closed that way, whatever the
  code, so connecting again works
- tests/failures.rs in bakashrot-client: a fake TLS server answering
  late, wrongly, cut short; end_to_end.rs for a revoked certificate and
  a failed upload; docs (client.md, server.md) and revamp.md (step 18)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 23:37:01 +01:00
parent 6fae7e61c9
commit 8ebac633d0
8 changed files with 681 additions and 50 deletions
+5 -1
View File
@@ -389,6 +389,10 @@ fn revoked_certificates_are_dropped() {
// Its open connection goes at its next request, a new one is refused.
let error = connected.push("logs", "{}").unwrap_err();
assert_eq!(error.code(), ErrorCode::ConnectionLost.code(), "{error}");
// Closed by the client too: the next one isn't even sent.
let error = connected.push("logs", "{}").unwrap_err();
assert_eq!(error.code(), ErrorCode::NotConnected.code(), "{error}");
assert!(!connected.is_open());
let error = running.connect(&kitchen).unwrap_err();
assert_eq!(error.code(), ErrorCode::AuthRejected.code(), "{error}");
// Others go on.
@@ -1098,7 +1102,7 @@ fn attachment_edges() {
.unwrap_err();
assert_eq!(error.code(), ErrorCode::FileError.code(), "{error}");
let error = kitchen.push("logs", "{}").unwrap_err();
assert_eq!(error.code(), ErrorCode::ConnectionLost.code(), "{error}");
assert_eq!(error.code(), ErrorCode::NotConnected.code(), "{error}");
let started = Instant::now();
while uploads(&mut analyst) != none_left {
assert!(