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

Fixed two peers sending the same attachment at once, Noted the stream limits, Removed the PureBasic-era leftovers

- An attachment is received from one peer at a time: the others are
  refused NotReady and ask again at their next sync; one cut short lets
  the next one take it over
- A 'replicating' row with all its bytes but never checked is asked
  again from part 0, and a peer asking from the wrong part resets it
- Noted the stream limit (1,048,575 topic/node pairs, 2^43-1 message ids
  each) in the example config and known-issues.md
- Removed NoDefaultTopic (code 6, retired), Writer::vacuum, the v8
  detection and the old ini key tests
- Cleared the PureBasic-era notes from the docs, revamp.md keeping only
  the old open items still unfixed; noted the GUI explorer (egui)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 17:23:33 +01:00
parent 764bc3652a
commit a5a2f65442
38 changed files with 436 additions and 907 deletions
+6 -7
View File
@@ -1,15 +1,14 @@
//! The error codes: what a server sends with each refusal (1-99, in a
//! `RequestRefused`), and the client's own (100 and up, what the DLL's
//! `BakaShrot_GetLastError()` returns). The same numbers as protocol 6
//! (`OldSource/Client/BakaShrot_ErrorCodes.pbi`): never renumber one, only
//! add new ones.
//! `BakaShrot_GetLastError()` returns). Never renumber one, only add new
//! ones; 6 is retired, never reuse it.
//!
//! What to do about each:
//! - reconnect, then retry: `NotConnected`, `ConnectFailed`,
//! `ConnectionLost`, `ProtocolError` (the connection is closed);
//! - retry later: `NotReady`, `ServerError`;
//! - fix the configuration: `AuthRejected`, `ServerNotVerified`,
//! `NotAllowed`, `UnknownName`, `NoDefaultTopic`;
//! `NotAllowed`, `UnknownName`;
//! - update one end: `VersionMismatch`;
//! - fix the call: `InvalidArgument`, `InvalidRequest`, `TooBig`,
//! `QueryFailed`, `FileError`;
@@ -71,7 +70,6 @@ error_codes! {
NotFound = 3, "No such message or attachment.";
NotReady = 4, "The attachment isn't on this server yet (still being replicated).";
TooBig = 5, "A message, attachment or query result over a limit, or an attachment bigger than this server keeps.";
NoDefaultTopic = 6, "Protocol 6's: a push without a topic and no default one. Protocol 7 pushes always name their topic: never sent, kept so the number isn't reused.";
InvalidRequest = 7, "A request that doesn't fit: an attachment's parts not matching its size, a part that doesn't exist...";
DataMismatch = 8, "An uploaded attachment that doesn't match its SHA-256: dropped.";
QueryFailed = 9, "The SQL of a query failed (its error in the reason).";
@@ -131,14 +129,13 @@ mod tests {
use super::*;
#[test]
fn the_numbers_of_protocol_6() {
fn the_numbers_never_change() {
let expected: &[(u32, &str)] = &[
(1, "NotAllowed"),
(2, "UnknownName"),
(3, "NotFound"),
(4, "NotReady"),
(5, "TooBig"),
(6, "NoDefaultTopic"),
(7, "InvalidRequest"),
(8, "DataMismatch"),
(9, "QueryFailed"),
@@ -164,6 +161,8 @@ mod tests {
assert_eq!(known.is_refusal(), *code < 100);
assert!(!known.description().is_empty());
}
// Retired: never given to another code.
assert_eq!(ErrorCode::from_code(6), None);
}
#[test]