Limit direct payload hops

This commit is contained in:
Janez T
2026-03-05 08:30:06 +01:00
parent 5beac70644
commit c83eaa4d98
7 changed files with 172 additions and 11 deletions

View File

@@ -36,6 +36,7 @@ class VoiceSession {
/// Manages incoming voice packet sessions and coordinates playback.
class VoiceProvider with ChangeNotifier {
static const String _voiceSessionsStorageKey = 'stored_voice_sessions_v1';
static const int maxDirectPayloadHops = 3;
final VoiceCodecService _codec;
final VoicePlayerService _player;
late final StreamSubscription<void> _playerEventsSub;
@@ -161,6 +162,12 @@ class VoiceProvider with ChangeNotifier {
);
return false;
}
if (requester.outPathLen > maxDirectPayloadHops) {
debugPrint(
'⚠️ [VoiceProvider] Requester ${requester.advName} is too far: ${requester.outPathLen} hops (max $maxDirectPayloadHops)',
);
return false;
}
for (final packet in cached.packets) {
if (requestedIndices != null &&