Fix review findings, add default flood scope, and address recent issues
Review fixes: - Keep stored message history beyond the 200-message window; stop messages leaking between radios; reset link/session state on disconnect - Accept firmware's 176-byte RX frames over USB/TCP - Hold APP_START during contact sync; contact-sync watchdog; replay DMs from not-yet-known senders; tombstone late command replies; finish channel sync on ERR_NOT_FOUND; fail region-scoped sends cleanly - DM retry watchdog when RESP_CODE_SENT never arrives; late repeater CLI replies; ACK hash collisions; UTF-8-safe name truncation - Image pipeline: delete-during-decode, lifecycle cancels, decoder memory release, entry cap, dead worker recovery, atomic model writes - Storage: deterministic reaction hash across web/native, Smaz double-decode, per-entry parsing, per-radio path history and regions, review-mode data isolation - UI: safe channel slot selection, byte-length name limits, double-send guard, mounted checks, localized hardcoded strings - Skip persisted-store reload on repeat SELF_INFO Features: - Radio default flood scope (firmware ver 11+) and explicit unscoped sends (ver 12+) - Scan for nearby nodes (#570) - Optional distinct first-hop repeater counting for channel resend (#589) - Optional region next to hop count (#580) Issues: - Message text follows system font size (#569) - Repeater/room password field accepts 20 chars (#576) - TCP auto-reconnect and keepalive (#571) - Order feeds by local receive time; flag future timestamps (#584) - Coding rate help text (#568), French "Favoris" (#575) - iOS/macOS app badge now clears Translations for all new strings in every locale.
This commit is contained in:
1 parent
a64a33d0c0
commit
25f197c979
120 files changed
+10424
-687
No files matched your search
@@ -21,6 +21,28 @@ class _FakeConnector extends MeshCoreConnector {
|
||||
}) async {}
|
||||
}
|
||||
|
||||
class _ShortTimeoutConnector extends _FakeConnector {
|
||||
final List<Uint8List> sentFrames = [];
|
||||
|
||||
@override
|
||||
int calculateTimeout({
|
||||
required int pathLength,
|
||||
int messageBytes = 100,
|
||||
String? contactKey,
|
||||
int? deviceTimeoutMs,
|
||||
}) => 30;
|
||||
|
||||
@override
|
||||
Future<void> sendFrame(
|
||||
Uint8List data, {
|
||||
String? channelSendQueueId,
|
||||
bool expectsGenericAck = false,
|
||||
bool waitForGenericAck = false,
|
||||
}) async {
|
||||
sentFrames.add(data);
|
||||
}
|
||||
}
|
||||
|
||||
Contact _repeater(int seed) => Contact(
|
||||
publicKey: Uint8List.fromList(List<int>.generate(32, (i) => seed + i)),
|
||||
name: 'R$seed',
|
||||
@@ -118,4 +140,63 @@ void main() {
|
||||
expect(result, 'unprefixed');
|
||||
});
|
||||
});
|
||||
|
||||
group('RepeaterCommandService retries', () {
|
||||
test('late reply to an earlier attempt completes the command', () async {
|
||||
final connector = _ShortTimeoutConnector();
|
||||
final service = RepeaterCommandService(connector);
|
||||
addTearDown(service.dispose);
|
||||
final repeater = _repeater(1);
|
||||
String? result;
|
||||
unawaited(
|
||||
service
|
||||
.sendCommand(repeater, 'password x', retries: 3)
|
||||
.then((r) => result = r, onError: (_) {}),
|
||||
);
|
||||
|
||||
// Attempt 1 (00|) times out after 30ms and attempt 2 (01|) is sent.
|
||||
await Future<void>.delayed(const Duration(milliseconds: 45));
|
||||
expect(connector.sentFrames, hasLength(2));
|
||||
|
||||
service.handleResponse(repeater, '00|OK');
|
||||
await pumpEventQueue();
|
||||
expect(result, 'OK');
|
||||
|
||||
// No third attempt goes out once the call has completed.
|
||||
await Future<void>.delayed(const Duration(milliseconds: 60));
|
||||
expect(connector.sentFrames, hasLength(2));
|
||||
});
|
||||
|
||||
test('prefixes are released once the command finishes', () async {
|
||||
final connector = _ShortTimeoutConnector();
|
||||
final service = RepeaterCommandService(connector);
|
||||
addTearDown(service.dispose);
|
||||
final repeater = _repeater(1);
|
||||
Object? error;
|
||||
await service.sendCommand(repeater, 'ver', retries: 2).catchError((
|
||||
Object e,
|
||||
) {
|
||||
error = e;
|
||||
return '';
|
||||
});
|
||||
expect(error, isNotNull);
|
||||
|
||||
String? result;
|
||||
unawaited(
|
||||
service
|
||||
.sendCommand(repeater, 'ver', retries: 1)
|
||||
.then((r) => result = r, onError: (_) {}),
|
||||
);
|
||||
await pumpEventQueue();
|
||||
// Replies to the finished call's prefixes are ignored.
|
||||
service.handleResponse(repeater, '00|stale');
|
||||
service.handleResponse(repeater, '01|stale');
|
||||
await pumpEventQueue();
|
||||
expect(result, isNull);
|
||||
|
||||
service.handleResponse(repeater, '02|fresh');
|
||||
await pumpEventQueue();
|
||||
expect(result, 'fresh');
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user