mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-19 17:05:33 +10:00
Msg Retry fixes, channel message fixes. Notification fixes. Make more desktop friendly. Enhance retry algo. Fix predicted location clustering add retries to reactions and fix the reactions in private DMS centralize and cleanup code in var areas
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'contact.dart';
|
||||
|
||||
const int recentAttemptDiversityWindow = 2;
|
||||
|
||||
class PathSelection {
|
||||
final List<int> pathBytes;
|
||||
final int hopCount;
|
||||
@@ -9,3 +15,38 @@ class PathSelection {
|
||||
required this.useFlood,
|
||||
});
|
||||
}
|
||||
|
||||
PathSelection resolvePathSelection(
|
||||
Contact contact, {
|
||||
PathSelection? selection,
|
||||
bool forceFlood = false,
|
||||
}) {
|
||||
if (contact.pathOverride != null) {
|
||||
if (contact.pathOverride! < 0) {
|
||||
return const PathSelection(pathBytes: [], hopCount: -1, useFlood: true);
|
||||
}
|
||||
return PathSelection(
|
||||
pathBytes: contact.pathOverrideBytes ?? Uint8List(0),
|
||||
hopCount: contact.pathOverride!,
|
||||
useFlood: false,
|
||||
);
|
||||
}
|
||||
|
||||
if (forceFlood || contact.pathLength < 0 || selection?.useFlood == true) {
|
||||
return const PathSelection(pathBytes: [], hopCount: -1, useFlood: true);
|
||||
}
|
||||
|
||||
if (selection != null && selection.pathBytes.isNotEmpty) {
|
||||
return PathSelection(
|
||||
pathBytes: selection.pathBytes,
|
||||
hopCount: selection.hopCount,
|
||||
useFlood: false,
|
||||
);
|
||||
}
|
||||
|
||||
return PathSelection(
|
||||
pathBytes: contact.path,
|
||||
hopCount: contact.pathLength,
|
||||
useFlood: false,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user